- Heaps will always have sorted numbers.
- Hash functions will always have a chance of collsion.
- Heap should insert the first number at 0.
- You should use Hashing when your values are in order.
- The first value of the heap is the least or greatest number.
- Its better to have a table size that is prime.
- To get the left child of an index in the heap you do 2i + 1.
- Difference between Min and Max heap.//3
- Explain how a heap removes an item.//3
- Explain why Modular Arithmatic uses Table_Size.
- Explain the difference between open addressing and separate chaining.
- Explain Truncation.
- Explain how option1 string to int can make a collsion.
bonus. Whats the difference between (node.val) and (node->val).
- Does this IsFull Function work. Yes/ No. Explain!
bool isFull(int hsize){
bool full = false;
if(hsize == SIZE-1)
full = true;
return full;
}
- Does this Insert Heap Function work. Yes/ No. Explain!
void insert(Heap heap, int val){
++heap.hsize;
int j = heap.hsize;
while(heap.arr[j/2] > val){
heap.arr[j] = heap.arr[j/2];
j /=2;
}
heap.arr[j] = val;
}
- Does this Add Hash Function work. Yes/ No. Explain!
void Hash_Add(HASH hash[], CUSTOMER cust){
int index;
index = cust.id % Table_Size;
nd temp = malloc(sizeof(NODE));
temp->cust = cust;
temp->next = NULL;
temp->next = hash[index].head;
hash[index].head = temp;
}
-
Code one of the String to Integer functions
-
Code one hashing function.
-
Code Double Hashing.