Sets, Maps, and BSTs.pdf - Root of subtree Root Nodes 3 Optimization Move Entry Point Flip Links Values Problem Search is slow even if we spend extra

Sets, Maps, and BSTs.pdf - Root of subtree Root Nodes 3...

This preview shows page 1 - 3 out of 6 pages.

2 :ree ('bstraction 3 5 1 0 2 4 6 Root Leaf (also subtree) Subtree Root of subtree Nodes Values Recursive Description : root and subtree . Each subtree is itself a valid tree. A tree with zero subtrees is a leaf . Relative Description : node and value . Each node has a value. A parent node is joined with an edge to each child node. We oftentimes abuse the terminology a bit by saying things like, “each parent is the sum of its children”. " : What does the “root node” refer to? What does the “root value” refer to? 5ptimization&! 3ove +ntry 6oint° ,lip 2inks Problem : Search is slow even if we spend extra time adding keys to their sorted position. Solution 2 : Move the entry pointer to the middle. Flip the left links. 8 D E F C B G A " : How does this change affect the worst-case search time? " : How can we improve this optimization?
Image of page 1
5ptimization&! 3ove +ntry 6oint° ,lip 2inks° ;se 2onger .ops Problem : Search is slow even if we spend extra time adding keys to their sorted position. Solution 2 : Move the entry pointer to the middle. Flip the left links. Use longer hops. 9 D E F C B G A D E F C B G A We saw this pattern of recursive subdivision in merge sort, and it’s here again!
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 6 pages?

  • Spring '14

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors