Skip to content

Latest commit

 

History

History

open-addressing-hash-table

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Open-addressing Hash Table

table.c

struct data {
  int key;
  int value;
};

struct node {
  struct data *data;
  struct node *next;
};

struct table {
  struct node **elements;
  unsigned int size;
  unsigned int length;
};

table.h

Create a table.

Table* create(unsigned int size);

Inserts an element into the table.

unsigned int insert(Table *table, unsigned int key, int value);

Computes the hash value for a given key.

unsigned int hashing(Table *table, unsigned int key);

Finds an element in the table.

Node* find(Table *table, unsigned int key);

Prints all table elements.

void print(Table *table);

Prints element in the table.

void printElement(Node *node);

Checks if the table is empty.

bool isEmpty(Table *table);

Checks if the table is full.

bool isFull(Table *table);

Returns the length of the table.

unsigned int length(Table *table);