Pseudo-codes have been taken from Cormen et al., Introduction to Algorithms 2009
To run the file, you need to download the whole folder, as header files are required to run the package.
The doubly linked list contains 2 pointers: backwards and forwards. My file does not implement a dummy object that marks as the beginning/end of this linked list but rather marking the head/tail pointers as null.
Each position index in the hash table will be a doubly linked list. New key will be added to linked list of index key. However, this method can lead to non-uniform distribution.
Only one key will be stored into one index of the table. However, if the number of key is greater than the number of index in the table, overflow will occur.
A node in a binary search tree consists of a value, its children left and right nodes, and its parent node. Each binary search tree contains exactly one node that acts as the root. Operations such as searching, insertion, deletion are performed on a tree.
A red-black tree is a binary tree that satisfies the following red-black properties (Cormen et al., Introduction to Algorithms 2009):
- Every node is either red or black.
- The root is black.
- Every leaf (NIL) is black.
- If a node is red, then both its children are black.
- For each node, all simple paths from the node to descendant leaves contain the same number of black nodes.
Therefore, after insertion or deletion, it will make a apply a re-colouring process to ensure the red-black properties of the trees.