Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 1.4 KB

File metadata and controls

47 lines (29 loc) · 1.4 KB

Sorting

Sorting refers to the rearranging the values in an array or collection into a specific order, usually into their natural order. Sorting can be solved with the use of many sorting algorithms, where some are faster and others slower. Additional tradeoffs include the use of memory, or the types of data being sorted.

Some common sorting algorithms include:

  • Selection sort: look for the smallest element, move to front
  • Bogo sort: shuffle and check
  • Bubble sort: swap adjacent pairs that are out of order
  • Insertion sort: build an increasingly large sorted front portion
  • Merge sort: recursively divide the array in half and sort it
  • Hap sort: place the values into a sorted tree structure
  • Qick sort: recursively partition array based on a middle value
  • Bcket sort: cluster elements into smaller groups, sort them

Reading

zyBooks Ch 6.1 - 6.8

Examples

https://github.com/ava11235/it212/blob/main/MergeSort.java

https://github.com/ava11235/it212/blob/main/SelectionSort.java

Reference

Sorting algorithms visualization:

https://www.youtube.com/watch?v=kPRA0W1kECg&t=3s

See sorting section https://www.bigocheatsheet.com/

Practice

zyBooks Ch 6.1 - 6.8 Participation Activities

Learning Outcomes

Upon successful completion of the material, students will be able to:

  • Describe several sorting algorithms and their Big Oh notation.
  • Implement several sorting algorithms in Java.