10.2. Comparing and Sorting¶
10.2.1. 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
10.2.2. Introduction to Ordering, Comparing, and Sorting¶
Follow Along and Engage
Download the slides corresponding to the video. Take notes on them as you watch the video, practice drawing diagrams yourself!
![](https://courses.cs.vt.edu/cs2114/opendsa/icons/projector-screen.png)
10.2.3. Checkpoint 1¶
10.2.4. Interactive: Introduction to Sorting¶
Follow Along and Engage
Download the slides corresponding to the video. Take notes on them as you watch the video, practice drawing diagrams yourself!
![](https://courses.cs.vt.edu/cs2114/opendsa/icons/projector-screen.png)
10.2.5. Checkpoint 2¶
10.2.6. Interactive: Selection Sort¶
Follow Along and Engage
Download the slides corresponding to the video. Take notes on them as you watch the video, practice drawing diagrams yourself!
![](https://courses.cs.vt.edu/cs2114/opendsa/icons/projector-screen.png)
10.2.7. Checkpoint 3¶
10.2.8. Insertion Sort with an Array¶
Follow Along and Engage
Download the slides corresponding to the video. Take notes on them as you watch the video, practice drawing diagrams yourself!
![](https://courses.cs.vt.edu/cs2114/opendsa/icons/projector-screen.png)
10.2.9. Checkpoint 4¶
10.2.10. Insertion Sort with a Linked Chain¶
Follow Along and Engage
Download the slides corresponding to the video. Take notes on them as you watch the video, practice drawing diagrams yourself!
![](https://courses.cs.vt.edu/cs2114/opendsa/icons/projector-screen.png)
10.2.11. Checkpoint 5¶
10.2.12. Programming Practice: Insertion Sort¶
10.2.13. Introduction to Comparators¶
Follow Along, Practice and Explore
Download to run and explore the java file (see below) from the video on your own in eclipse. You may download the standalone *.java file Download to run and explore the corresponding project from the video on your own in eclipse. The project CS2-Support is required for the sample project. It is also used in your course projects. To download the CS2-Support you must first complete the configuration steps for your first lab. You will then be able to download it via eclipse using the blue down arrow icon or using the Project Menu and selecting “Download Assignment…”
![](https://courses.cs.vt.edu/cs2114/opendsa/icons/icons8-java60.png)
![](https://courses.cs.vt.edu/cs2114/opendsa/icons/projector-screen.png)