• Home
  • University of the People
  • Data Structures (proctored course) CS 3303
  • Data Structures - Sorting Algorithms

Data Structures - Sorting Algorithms

CS 3303-01 Data Structures - AY2022-T5 Dashboard My courses CS 3303-01 - AY2022-T5 21 July - 27 July Learning Guide Unit 6 Learning Guide Unit 6 Learning Guide Unit 6 Overview Unit 6: Internal Sorting Techniques and Algorithms Topics: Sorting terminology and notation Basic sorting algorithms (insertion, bubble, and selection) Advanced sorting algorithms (shellsort, mergesort, quicksort, heapsort, binsort and radix sort) Comparison of sorting algorithms Learning Objectives: Understand the terminology of sorting algorithms Understand and be able to implement basic sorting algorithms including: o Insertion sort o Bubble sort o Selection sort Recognize and be able to articulate the inefficiencies in these sorting algorithms Understand the concept of an exchanges and how this is used in exchange sorts. Understand and be able to implement the following advanced sorting algorithms o Shellsort o Mergesort o Quicksort o Heapsort o Binsort and Radix Sort Understand and be able to apply Asymptotic analysis against sorting routines to determine their cost in terms of processing time. Introduction In Unit 6, we explore sorting algorithms. Sorting algorithms are absolutely essential in most computer science applications. Because sorting is so important it has been extensively studied and many types of sorting algorithms have been developed in an effort to find algorithms that can achieve better average case performance. There is, however, no one perfect sorting algorithm. The best algorithm for any particular sorting problem will be determined by the characteristics of the problem. In our text, Schaffer suggests that the Quicksort yields the best in- memory general purpose sorting in the average case, but this high praise is tempered as Shaffer quickly conceded that the quicksort can also be hampered by exceedingly poor worst-case performance. From this, we learn that we must develop a good understanding of each major type of sorting algorithm and the characteristics of the sorting problem that may make a particular sorting algorithm a good or bad solution to solve the problem. The following section will provide an outline of each major sorting algorithm and attempt to outline some of the characteristics of a sorting problem that it is well suited to solve. As you progress through this unit, read the descriptions of each type of sorting routine, and examine the code fragments in the text, it would be recommended that you also visit the following websites that provide animations that show the various sorting algorithms in action. Sorting algorithms animations. (n.d.). toptal. Retrieved from https://www.toptal.com/developers/sorting-algorithms Algorithm animations and visualizations. (n.d.). Retrieved from http://www.algoanim.ide.sk/ Insertion Sort The insertion sort is a relatively simple sort. With the sort two zones in the array are maintained to be sorted: sorted and unsorted. At the beginning, the sorted zone consists of one element. On each step, the algorithms expand it by one element inserting the first element from the unsorted zone in the proper place in the sorted zone and shifting all larger elements one slot down. It is an algorithm that many people intuitively use for sorting cards and it is very easy