90 likes | 209 Vues
Discover how treaps, a unique combination of binary search trees and heaps, can be used to develop an innovative DVD rental system. By utilizing separate treaps for in-stock movies, checked-out movies, and membership records, the system allows features like adding new films and members, as well as checking movies in and out. This setup guarantees efficient search times (Θ(lg n)) while enhancing user functionality. Future improvements like a GUI and more detailed DVD info can further optimize the system, making it a solid choice for managing movie rentals.
E N D
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 • 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
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
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
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
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!