Searching Flashcards
How many compares are used for search hits in sequential search in the worst case?
N compares
How many compares to insert into an inittally empty Linked List Symbol Table?
N^2 / 2
How many compares does a search hit use in a BST?
2 ln N
How many compares do insertions and search misses in a BST require?
2 ln N
What is the height of a red-black BST?
2 lg N
What is the average lenth of a path from root to node in a RB tree?
1.00 lg N
Which operations take logarithmic time in the worst case in a RB BST?
- Search
- inesrt
- min
- max
- floor
- ceiling
- rank
- select
- delete min
- delete max
- range count
What are the compares used for search and insert in the worst case for 2-3 trees?
lg N
What is the average length of the lists in separate chaining?
N / M
Why is the probability that the number of keys in a list is within a small constant factor of N/M, close to 1?
What is the growth rate of the average length of the longest list in a separate chaining?
log N / log log N
What are the number of compares for miss and insert in a Separate Chaining has table?
N/M
How does get()
work in sequential search in an unordered symbol table?
Scan through list, using equals()
to compare search key with key in each node.
How does put()
work in a linked list implementation of an unordered symbol table?
Same as get(), however update value once match is found, else inserted at beginning.
How does binary search work?
Compare search against key in middle half.
* If search < middle, search left, else right.