1 / 9

Treaps and a DVD Checkout System

Treaps and a DVD Checkout System. Jim Moiani Michael Crocker. It’s a tree… it’s a heap…. A treap is a balanced binary search tree It’s node is similar to a binary search tree’s node (has pointer to left and right, and a key) Also contains a random priority

ford
Download Presentation

Treaps and a DVD Checkout System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Treaps and a DVD Checkout System Jim Moiani Michael Crocker

  2. It’s a tree… it’s a heap… • A treap is a balanced binary search tree • It’s node is similar to a binary search tree’s node (has pointer to left and right, and a key) • Also contains a random priority • Since the priorities are randomly assigned, nodes can be inserted like they would for a binary search tree, and then rotated so that the priorities of the nodes also maintain the properties of a heap

  3. What do you use it for? • We used treaps to create a DVD rental system • Separate treaps for in-stock movies, checked-out movies, and a record of the membership • Features include ability to add new movies and members, display a member’s records, and check movies in and out

  4. So what are the benefits? • Provides all the functionality of binary search trees, like inorder traversal, but also guarantees a Θ(lg n) search time • Of course, this is given that you’ve made enough insertions so that the priorities approach a normal distribution

  5. What’s left to add? Possible Improvements • A GUI • Provides overdue notification; could interface with a member account system (debit credit cards for overdue movies?) • A few member functions work by entering the member number; could interface with a scanner • More info for DVDs, like UPC, release date, review notes, and other information

  6. And one more… • More treaps which are pointers to our member classes, which can be referenced to sort and display other categories quickly and easily • Sort DVDs by rating, release year, title, and so on… • Sort members by name, location, member number • All without searching the whole treap!

  7. And now, a demonstration…

More Related