Sorts and Algo Rythmic part 1
Learn and perform Algo Rythmic interpretation of Classes, Queues, performing Sorts.
Algo Rythmics Planning and Coding Week
There is a craze in either Dancing or Algo Rythmic societies to combine Coding and Dancing. Plus, Computer Science at Del Norte needs a traditional activity (aka Physics Boat races)!!! You will be first gneraction to perform. Here are some samples ...
This is a two week mini project containing Sorting Code and Algo Rythmic performance of your favorite algorithm. Have fun and don't be afraid to be creative.
Information about Selection Sort, Insertion Sort, Merge Sort
For the AP exam, there are three main sort algorithms you will need to know and be able to use fluently:insertion, merge, and selection sort.
- Selection Sort Lecture on Arrays/ArrayLists
Selection sort is a linear sort algorithm as it moves from index [0] to [n-1]. In the inner loop which is a second linear loop it compares two elements (like seen in the visual below) and notes which is smallest, after cycling to the end it swaps the smallest number to beginning position in the round.
-
Insertion Sort Lecture on Arrays/ArrayLists -- Sample code that Sorts Objects
Insertion sort is another linear algorithm that sorts elements from index [0] to index [n-1]. In the inner loop of this algorithm, it finds the gap, insertion point for the next item and inserts it. Each inner loop leave the list partially sorted according to outer loops index.
-
Merge Sort Algorithm part 1, Algorithm part 2
This algorithm uses a divide and conquer algorithm, versus linear algorithm of insertion or selection sort. Looking at it can be complicated, but it is more simple than it looks. It divides the array into two different groups recursively, until it gets only two to compare, swaps if necessary. Then it pops out of the recursion, observe the cascading and then the inverted assembly in illustration, after pop it puts each split group back together using a sorted comparison.
Hacks
CB wants you to work with Bubble Sort, Selection Sort, Insertion Sort and Merge Sort. The material on these sorts is prevelant on the Internet and ChatGPT.
- Build into this Jupyter Notebook(s) for Bubble Sort, Selection Sort, Insertion Sort and Merge Sort.
- Build into this Jupyter Notebooks Tester methods that runs each Sort
- Commit to GitHub Repository often, try to use GitHub commits to show iterations on work
- Note, build your sorts into Generic T Queue using toString and compareTo to compare keys.