.. This file is part of the OpenDSA eTextbook project. See .. http://opendsa.org for more details. .. Copyright (c) 2012-2020 by the OpenDSA Project Contributors, and .. distributed under an MIT open source license. .. avmetadata:: :author: Molly Domino Comparing and Sorting ===================== Objectives ---------- Upon completion of this module, students will be able to: * Describe concepts of ordering and sorting * Develop methods to compare primitives and Objects * Describe and develop classes which implement the Comparable interface or the Comparator interface * Describe the behavior of various sort methods including: bubble sort, selection sort, and insertion sort * Discuss the relative efficiencies of various sort methods * Implement, test, and use various sort methods and methods which support comparisons * Identify when to use the Comparable interface vs the Comparator interface Introduction to Ordering, Comparing, and Sorting ------------------------------------------------ [13:39] Introduction to Sorting and Comparing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. raw:: html
.. raw:: html
Video Slides 12.1.2.1-IntroOrderingAndComparing.pdf Checkpoint 1 ------------ .. avembed:: Exercises/MengBridgeCourse/CompSortCheckpoint1Summ.html ka :long_name: Checkpoint 1 Introduction to Sorting Video ----------------------------- [12:51] Introduction to Sorting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. raw:: html
.. raw:: html
Video Slides 12.1.3.1-IntroToSorting.pdf Checkpoint 2 ------------ .. avembed:: Exercises/MengBridgeCourse/CompSortCheckpoint2Summ.html ka :long_name: Checkpoint 2 Selection Sort Video -------------------- [12:36] Selection Sort ~~~~~~~~~~~~~~~~~~~~~~ .. raw:: html
.. raw:: html
Video Slides 12.1.4.1-SelectionSort.pdf Checkpoint 3 ------------ .. avembed:: Exercises/MengBridgeCourse/CompSortCheckpoint3Summ.html ka :long_name: Checkpoint 3 Insertion Sort -------------- [16:17] Insertion Sort Array ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. raw:: html
.. raw:: html
Video Slides 12.1.5.1-InsertionSortArray.pdf Checkpoint 4 ------------ .. avembed:: Exercises/MengBridgeCourse/CompSortCheckpoint4Summ.html ka :long_name: Checkpoint 4 Insertion Sort Array -------------------- [16:50] Insertion Sort Linked Chain ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. raw:: html
.. raw:: html
Video Slides 12.1.6.1-InsertionSortLinked.pdf Checkpoint 5 ------------ .. avembed:: Exercises/MengBridgeCourse/CompSortCheckpoint5Summ.html ka :long_name: Checkpoint 5 Programming Practice: Insertion Sort ------------------------------------ .. extrtoolembed:: 'Programming Practice: Insertion Sort' :workout_id: 1925 Comparators ----------- Comparator Example Code ~~~~~~~~~~~~~~~~~~~~~~~ .. admonition:: Try It Yourself In Eclipse, use the *Project > Download Assignment...* menu command to download the exercise project named "ex12.01-Comparing". Use this example to follow along with the following video. Feel free to experiment. Refer to `01.02: Lab: LightBot for Beginners `_ if you need to review the instructions for downloading Eclipse projects. [11:22] Introduction to Comparators ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. raw:: html
.. raw:: html
Video Slides 12.1.8.1-Comparators.pdf Programming Practice: Comparators --------------------------------- .. extrtoolembed:: 'Programming Practice: Comparators' :workout_id: 1926