To remove a key from hash table, we will first calculate its index and extract its Linked List, find the key in list and remove it if it is present.ġ. To display all the elements of hash table, Linked List at each index is extracted and elements(key and value) are read until we reach at its end.Ĩ. In case the list already exists, search for the key (given as input) in the Linked List, and add the data item (key and value) at the end of list if key does not belong to the list and increment the size, otherwise update the value of given (and already present) key in the Linked List.ħ. In case of absence of a Linked List, create one and insert a data item(key and value) into it and increment the size of hash table.Ħ. Using the generated index, extract the Linked List located in that array index.ĥ. Corresponding to the key, an index will be generated i.e every key is stored in a Linked List of a particular array index.Ĥ. Take a key and a value to be stored in hash table as input.ģ. Create an array of Linked List (i.e a hash table).Ģ.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |