# midterm 2.docx - Selection sort is a sorting algorithm that...

• 2

This preview shows page 1 - 2 out of 2 pages.

Selection sortis a sorting algorithm that treats theinput as two parts, a sorted part and an unsorted part, and repeatedly selects the proper next value to move from the unsorted part to the end of the sorted part.Insertion sortis a sorting algorithm that treats theinput as two parts, a sorted part and an unsorted part, and repeatedly inserts the next value from the unsorted part into the correct location in the sorted part.Shell sortis a sorting algorithm that treats the input as a collection of interleaved lists, and sorts each list individually with a variant of the insertionsort algorithm. Shell sort uses gap values to determine the number of interleaved lists. A gap valueis a positive integer representing the distance between elements in an interleaved list. Quicksortis a sorting algorithm that repeatedly partitions the input into low and high parts (each part unsorted), and then recursively sorts each of those parts. To partition the input, quicksort chooses a pivot to divide the data into low and high parts. The pivotcan be any value within the array being sorted, commonly the value of the middle array element. Ex: For the list (4, 34, 10, 25, 1), the middle element is located at index 2 (the middle of indices [0, 4]) and has a value of 10.Merge sortis a sorting algorithm that divides a listinto two halves, recursively sorts each half, and then merges the sorted halves to produce a sortedlist. The recursive partitioning continues until a listof 1 element is reached, as a list of 1 element is already sortedRadix sortis a sorting algorithm designed specifically for integers. The algorithm makes use of a concept called buckets and is a type of bucketsort.A listis a common ADT for holding ordered data, having operations like append a data item, remove a data item, search whether a data item exists, and print the listA deque(pronounced "deck" and short for double-ended queue) is an ADT in which items can be inserted and removed at both the front and back.