1. Create a object for BST (binary tree item) with key and value
as data and left and right as a variable which points to node of
the BST type (left pointing to the left child of current node and
right pointing to the right child of current node).
2. Create another object BST (for binary tree) with head having the
address of root element of binary tree.
3. Now create an array of binary tree of some certain size(10, in
this case).
4. A menu is displayed on the screen.
5. User must choose one option from four choices given in the
menu.
6. 1st choice: Inserting item into hash table
(a) Take a key and a value as input.
(b) Calculate index as per the given key.
(c) Locate the binary tree at the calculated array index.
(d) If binary tree is present, check whether the key already
present in it by finding the node containing key using find()
method which returns NULL if key is not present. In that case, we
will create a data item and add it into binary tree. If key is
already present in the tree, we will update the value of node
containing key.
(e) If there is no tree at that particular array index, which means
the key is not present in hash table, then create a data item and a
binary tree and add the data item to it using insert_element()
function.
7. 2nd choice: Removing a key from hash table
(a) Take a key as input which needs to be removed.
(b) Calculate index as per the given key.
(c) Locate the binary tree at the calculated array index.
(d) If tree is present, find the node containing the key in binary
tree using find() method which returns NULL if key not present. The
key is removed using delete() method if it is present otherwise
‘Key not present’ message will get displayed.
(e) If there is no binary tree at that particular array index,
which means the key is not present in hash table, therefore no
deletion is required.
8. 3rd choice: Size of hash table
(a) Each time we add a new data item into the hash table, we
increment its size by 1.
(b) The size of the hash table can be determined either by size
variable or size_of_hashtable() method.
9. 4th choice: Display hash table
(a) Function display() runs for displaying hash table
contents.
(b) Here a for loop runs from 0 to array_size-1 with i as
iterator.
(c) The code inside loop consists of taking i as index and locating
each binary tree at that index of array.
(d) As the content of each node of tree is displayed the variables
left and right (pointers) is used to proceed further until all
elements are displayed.
for java 4. Instead of using a linked list to resolve collisions, as in separate chaining, use a binary search tre...
Instead of using a linked list to resolve collisions, as in separate chaining, use a binary search tree. That is, create a hash table that is an array of trees. To display a small tree-based hash table, you could use an inorder traversal of each tree. The advantage of a tree over a linked list is that it can be searched in O(logN) instead of O(N) time. This time savings can be a significant advantage if very high load factors...
PROGRAM DESCRIPTION Implement a hash table class. Your hash table should resolve collisions by chaining and use the multiplication method to generate hash keys. You may use your own linked list code from a previous assignment or you can use a standard sequence container. Partial definitions for the hash table class and a generic data class are provided (C++ and Java versions). You may use them as a starting point if you wish. If you choose to design your own...
Could someone please summarize the following for my programming class? They are study questions for java What an association list is. How to test if an association list is empty. How to find the value associated with a key in an association list. How to add a key-value pair to an association list. How to delete a key-value pair from an association list. How efficient an association list is (using O notation). What a circular list is. What a circular...
using java to write,show me the output. please write some
common.
You CAN NOT use inbuild functions for Tree ADT operations.
using code below to finsih
public class Main
{
public static void main(String[] args) {
BinaryTree tree = new
BinaryTree();
tree.root = new Node(1);
tree.root.left = new Node(2);
tree.root.right = new Node(3);
tree.root.left.left = new Node(4);
tree.root.left.right = new Node(5);
tree.root.right.left = new Node(6);
tree.root.right.right = new Node(7);
tree.root.left.left.left = new Node(8);
tree.root.left.left .right= new Node(9);...
How to write the insert, search, and remove functions for this hash table program? I'm stuck... This program is written in C++ Hash Tables Hash Table Header File Copy and paste the following code into a header file named HashTable.h Please do not alter this file in any way or you may not receive credit for this lab For this lab, you will implement each of the hash table functions whose prototypes are in HashTable.h. Write these functions in a...