Hash Tables - Quiz

  • AA data structure that stores data in a random order
  • BA data structure that stores data in a sorted order
  • CA data structure that maps keys to values using a hash function
  • DA data structure that links nodes together to form a list
  • ATo determine the order in which elements are stored in the table
  • BTo map keys to unique indices in the table
  • CTo sort the elements in the table
  • DTo count the number of elements in the table
  • ALinear probing
  • B Binary search
  • CDepth-first search
  • DBreadth-first search
  • A It can lead to clustering of elements in the table.
  • B It requires more memory than separate chaining.
  • C It requires more time to access elements than separate chaining.
  • DIt cannot handle collisions efficiently.
  • AIt is faster than open addressing.
  • BIt results in a more compact table than open addressing.
  • CIt can handle an arbitrary number of collisions.
  • DIt requires less memory than open addressing.
  • AThe number of elements in the table divided by the number of slots in the table.
  • BThe number of collisions in the table divided by the number of elements in the table.
  • CThe number of slots in the table divided by the number of elements in the table.
  • DThe number of elements in the table divided by the size of the hash function.
  • A Sorting data
  • BStoring data in a stack
  • CStoring data in a heap
  • DImplementing a dictionary or map
  • AWhen two or more keys map to the same index in the table.
  • BWhen the hash function produces a negative index.
  • CWhen the table is full and cannot store any more elements.
  • DWhen the load factor of the table exceeds a certain threshold.
  • AA function that maps every key to the same index in the table.
  • BA function that maps every key to a unique index in the table.
  • CA function that maps every key to a random index in the table.
  • DA function that maps every key to an index based on its length.