

























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


























































●
●
●
●
●
●
●
●
●
●
● Suppose we want to store a set of elements supporting the following operations: ● Insertion of new elements. ● (^) Deletion of old elements. ● Membership queries. ● (^) Successor queries. ● (^) Predecessor queries. ● Min/max queries. ● Can use a standard red/black tree or splay tree to get (worst-case or expected) O(log n ) implementations of each.
B D O U T G E A I O A E R D N D T A A I D I K T A T N T E K B C A D
●
●
●
●
●
●
●
●
●
B D O U T G E A I O A E R D N D T A A I D I K T A T N T E K B C A D
●
●
●
● Although time-efficient, tries can be extremely space-inefficient. ● A trie with N nodes will need space Θ( N · |Σ|) due to the pointers in each node. ● There are many ways of addressing this: ● Change the data structure for holding the pointers (as you'll see in the problem set). ● Eliminate unnecessary trie nodes (we'll see this next time).
●
●
●
●
●
● Consider the following naïve solution: for every possible starting position for P in T , check whether the | P | characters starting at that point exactly match P. ● Work per check: O(| P |) ● Number of starting locations: O(| T |) ● Total runtime: O(| P| · | T |). ● Is this a tight bound?