1 / 6

60 likes | 136 Views

CS 261 - Winter 2010. Tree Sort. Useful Properties of Sorted Data Structures. Skip Lists (as well as AVL Trees, and various other data structures we will eventually see) have two useful properties They have O(log n) insertion They keep their elements in order

Download Presentation
## CS 261 - Winter 2010

**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

**CS 261 - Winter 2010**Tree Sort**Useful Properties of Sorted Data Structures**• Skip Lists (as well as AVL Trees, and various other data structures we will eventually see) have two useful properties • They have O(log n) insertion • They keep their elements in order Together, these combine for a particularly simple sorting algorithm**YASA - Yet Another Sorting Algorithm**How to sort an Array (lets call it A) Step 1. Copy elements from A into a sorted data structure Step 2. Copy elements from the data structure back into A**Lets Analyze the Execution Time**Assume there are N elements Step 1. Copy elements from A into a sorted data structure O( ?? ) Step 2. Copy elements from the data structure back into A O( ?? )**We couldn’t we do this with arrays?**• Why couldn’t we do tree sort with a sorted dynamic array? • Why not an ordinary dynamic array?**That’s pretty good**• The execution time O(n log n) is the best we have seen so far - pretty good. And it is simple • Anybody see a downside?

More Related