1 / 34

An Adventure into Sorting

An Adventure into Sorting. By Mauktik Gandhi Date: 12 th May 2002. Some Sorting Algorithms. Bubble Sort Insertion Sort Selection Sort Merge Sort Heap Sort Quick Sort (avg.). Well Established fact. Using comparison based sorting the fastest we can go is n*log (n)

Download Presentation

An Adventure into Sorting

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. An Adventure into Sorting By Mauktik Gandhi Date: 12th May 2002

  2. Some Sorting Algorithms • Bubble Sort • Insertion Sort • Selection Sort • Merge Sort • Heap Sort • Quick Sort (avg.)

  3. Well Established fact • Using comparison based sorting the fastest we can go is n*log (n) • So we are bound by a theorem established long ago.

  4. Solution - Snip Snip • Well if it is not possible then whats the point trying. • So avoid comparison….

  5. Possible, but need help • ASCII characters are already sorted for us • Why not use them as helpers ?? • So I did, I cheated 

  6. Steps taken to sort • Prepare the internal representation for taking the items to be sorted • Continue building representation as items are added one at a time. • Remove the items, one by one, amazingly they are sorted All take constant time !

  7. That’s all, the first step is done. One node, the root of the amazing tree. Step 1.

  8. Step 2. Adding Words Lets add “Car”

  9. Lets add “Car” Adding “Car” C

  10. Lets add “Car” Adding “Car” C A

  11. Lets add “Lot” Completing “Car” C A R

  12. Lets add “Lot” Adding “Lot” C L A R

  13. Lets add “Lot” Adding “Lot” C L A O R

  14. Lets add “Lot” Completing “Lot” C L A O R T

  15. Adding “Cat” ?? Now add “Cat” C L A O R T

  16. Adding “Cat” ?? Now add “a” C L A O R T

  17. Adding “Cat” ?? That’s confusing C L A O R T T

  18. Now add “Go” Where does “Go” go ?? C L G A O R T T

  19. Now add “Go” Where does “Go” go ?? C L G A O O R T T

  20. Now to Remove_First No end in sight  C L G A O O R T T

  21. My head is bursting Removing First C L C G A A O O R T T

  22. Next Removing First C L G A O O T T

  23. Next Removing First L G O O T

  24. Continue Removing First L G O O T

  25. I cant take it any longer Removing First L O T

  26. Is it done ?? Well, its done

  27. Testing • That showed how to sort four items • Similarly, a large number of words can be sorted • Question: Is it efficient ?

  28. End Of Abstract Description WOW!! I survived the torture Hey, but what about efficiency??

  29. Now lets talk Concrete • Completed first implementation for RESOLVE/C++ • The working class is Sorting_Machine_Kernel_X Sorting_Machine/Kernel_X.h Sorting_Machine/Kernel_X_Body.h

  30. Number of words Time in Seconds Timing Comparison Table

  31. Quick Sort vs MySort

  32. I do a lot of work out here Processor taxing time !!

  33. What’s Next ? • Templates, recursion and lots of procedure calls seem to eat on efficiency • So plan to re-implement it using C/C++ • Avoid recursion • More efficient memory management • Minimize procedure calls • Lastly implement and use exploration trees • Help avoid recursion • No need to decompose and recompose

  34. The End

More Related