• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.


Module 7 - Sorting Part 1

Page history last edited by Dr. Ron Eaglin 4 years, 3 months ago

Module 7 - Sorting Part 1




Here is your practical application of data structures; sorting. There are literally hundreds of sorting algorithms and Topic - Sorting Techniques covers most of the important ones. Sorting is also tied very closely to searching, as it is much easier to search a sorted list. 




We are going to return to your List code from  Module 3 - Lists   You will need to fork your JSFiddle into a new Fiddle. In this Fiddle we are going to add sorting functions. This is a great time to clean up your list with things that you have learned. 


You should automatically populate the List with 20 element (random strings).


Once you have completed this - you will add 2 sort functions, you can use any sort method that you desire for each of the sort functions. You can also delineate the functions by the name of the Sort function - so your functions might be QuickSort() and MergeSort() - if you chose to implement those 2 algorithms (you can select from any sort functions).  


The interface should have buttons to (1) Repopulate the list with Random string , (2) Sort list with algorithm 1 (3) Sort list with algorithm 2 and (4) Insert a new random string entered by the user. After each operation it should display the new list.



The option 4 here will insert the new string entered by the user (you will need a check box)  in the correct sorted position and you should print the new list with the new element on the screen.




Do quiz on sorting  - http://geeksquiz.com/algorithms/searching-and-sorting/ 


Assignment Grading - Creating a random string array is worth 1 point. Each sort algorithm is worth 3 points, and the insertion is worth 3 points. 



Previous: Module 6 - Recursion

Next: Module 8 - Hashing Part 1

Comments (0)

You don't have permission to comment on this page.