Sorting & Searching
Sorting Sorting is the process of placing elements from a collection in some kind of order. Types: Ascending Descending Algorithms: Internal Sorting, where the data is loaded into the RAM External Sorting, where the data is stored in a secondary storage Bubble Sort The bubble sort makes multiple passes through a list. It compares adjacent items and exchanges those that are out of order. Each pass through the list places the next largest value in its proper place. In essence, each item “bubbles” up to the location where it belongs. Selection Sort The selection sort improves on the bubble sort by making only one exchange for every pass through the list. In order to do this, a selection sort looks for the largest value as it makes a pass and, after completing the pass, places it in the proper location. As with a bubble sort, after the first pass, the largest item is in the correct place. After the second pass, the next largest is in place. Insertion Sort Whi...