1 / 9

Exploring Sorting Algorithms: CS 112 Lab 02

Dive into sorting algorithms including Selection, Insertion, Merge, Quick, Shell, Heapsort, Bubble, Cocktail, and more. Practice implementing Bubble Sort and compare elements. Learn sorting in Java using Collections and Arrays.

butts
Download Presentation

Exploring Sorting Algorithms: CS 112 Lab 02

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 112 - Fall 2012, Lab 02 Haohan Zhu

  2. CS 112 - Fall 2012, Lab 02 Sorting Algorithm • Selection Sort • Insertion Sort • Merge Sort • Quick Sort • Sorting algorithm from the lectures

  3. CS 112 - Fall 2012, Lab 02 Sorting Algorithm

  4. CS 112 - Fall 2012, Lab 02 Sorting Algorithm • Shell sort • Heapsort • Sorting algorithm from the textbook

  5. CS 112 - Fall 2012, Lab 02 Sorting Algorithm • Bubble sort • Cocktail sort • Timsort (Java) • … • Other sorting algorithms

  6. CS 112 - Fall 2012, Lab 02 Sorting Algorithm • Sorting algorithms on Wikipedia • Popular algorithms but not a full list

  7. CS 112 - Fall 2012, Lab 02 Sorting Algorithm in Java • Class Collections • sort(List<T> list) • sort(List<T> list, Comparator<? super T> c) • Class Arrays • sort() for Primitive Types and Objects • PriorityQueue

  8. CS 112 - Fall 2012, Lab 02 Practice • Implementing Bubble Sort • Compare two adjacent elements and sort them 7 1 5 3 8 4 6 2 1 7 5 3 8 4 6 2 1 5 7 3 8 4 6 2

  9. CS 112 - Fall 2012, Lab 02 Practice • Bubble Sort or Cocktail Sort • Different directions 7 1 5 3 8 4 6 2 1 7 5 3 8 4 6 2 1 5 7 3 8 4 6 2

More Related