Bubble Sort and Selection sort Implementation in C++
Bubble sort is a simple algorithm for sorting. The sorting algorithm represents an algorithm that compares each pair of adjacent elements and the elements are exchanged if the elements are not in order. This algorithm is not suitable for larger data sets, as the average complexity is O(n2), where n corresponds to the number of objects.
Selection sort is a basic sorting algorithm. This method is a comparison-based algorithm that divides the list into two halves, the sorted part on the left end and the unsorted part on the right. Initially, the sorted section is empty, while the unsorted section contains the complete list. The smallest element from the unsorted array is chosen and swapped with the leftmost element, resulting in that element becoming a part of the sorted array. This operation is repeated until the unsorted array boundary is moved one element to the right.
All the details discuss with code in the video below:
- Recursion and Backtracking in C++
- Binary Search with Implementation in C++
- Linked List with Implementation in C++
- Python Machine Learning Cookbook