Join Peggy Fisher for an in-depth discussion in this video Sorting arrays, part of Up and Running with Java.
- View Offline
- Exercise Files
- It is often necessary to have an array…in sorted order, especially if you want…to later use it with a binary search…on the array, which requires the array…to be sorted first.…There are many different algorithms…available for sorting.…In this segment we're going to go…through a few of the most popular.…Let's start with a selection sort.…The selection sort starts with the first value…in the array and then compares it…to the remaining items, searching for the smallest…if we're trying to sort in ascending order,…or searching for the largest if we're…trying to sort in descending order value in the list.…
Once it is located, it swaps the two values.…It continues this process, looking for the next…value until the entire list is sorted.…The selection sort requires a nested loop.…We'll take a look at the two nested loops…when we look at the program source code.…The number of times the sort passes…through the array is always one less…than the number of items in the array.…In the selection sort the inner loop…finds the next smallest or largest value,…
- Downloading and exploring NetBeans
- Understanding Java basics: data types, strings, arrays, and more
- Controlling flow with functions and loops
- Creating classes
- Sorting and searching arrays
- Manipulating files
- Handling errors
- Building GUIs
Skill Level Beginner
1. Getting Started
2. Java Basics
3. Flow of Control
4. Classes and Objects
5. Beyond the Basics
6. File Manipulation
7. Graphical User Interface Basics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.