Skip to Content
C++ Data Structures and Algorithms
book

C++ Data Structures and Algorithms

by Wisnu Anggoro
April 2018
Intermediate to advanced content levelIntermediate to advanced
322 pages
6h 57m
English
Packt Publishing
Content preview from C++ Data Structures and Algorithms

Developing the Insert() operation

To insert a new element in a hash table, first we obtain a hash key from the key's element using HashFunction(). After we have the hash key, we check if the slot is available. If it's not available, we check another free slot using the linear formula we discussed at the beginning of this section. Since the open addressing technique stored all elements in the hash table itself at the beginning of the Insert() function implementation, we need to check if all slots have been occupied. If there is no free slot, the function will do nothing. Each time there's a new element to be added, we increase the currentSize variable to track the total elements in the hash table. The implementation of the function will be ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Structures and Algorithms Using C++

Data Structures and Algorithms Using C++

Ananda Rao Akepogu, Radhika Raju Palagiri
C++ Data Structures and Algorithm Design Principles

C++ Data Structures and Algorithm Design Principles

John Carey, Anil Achary, Shreyans Doshi, Payas Rajan
C++ Plus Data Structures, 6th Edition

C++ Plus Data Structures, 6th Edition

Nell Dale, Chip Weems, Tim Richards

Publisher Resources

ISBN: 9781788835213Supplemental Content