1 / 6

CS 261 - Winter 2010

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

nevaeh
Télécharger la présentation

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

Presentation Transcript


  1. CS 261 - Winter 2010 Tree Sort

  2. 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

  3. 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

  4. 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( ?? )

  5. 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?

  6. 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