-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

PLCs for Beginners
By :

There are more sorting algorithms than you can shake a stick at. Choosing the correct algorithm for a particular task will depend on factors such as the size of the dataset, how unsorted the dataset is expected to be, and so on. The following section is going to explore two of the most popular sorting algorithms and their possible use cases. The dataset we’re going to use for this section is going to be the following array:
[1,9,5,3,2,7];
For this chapter, we’re not going to screenshot the output for each algorithm. The way you can tell whether the algorithm worked is whether the data is sorted from least to greatest. To begin the discussion, we’re going to look at the famous, or as some would call it, infamous bubble sort algorithm.
In academia, a student’s first shake with a sorting algorithm is usually what’s called the bubble sort algorithm. The bubble sort algorithm is typically used...