C++ Sorting and Searching: Exercises, Practice, Solution
This resource offers a total of 70 C++ Sorting and Searching problems for practice. It includes 14 main exercises, each accompanied by solutions, detailed explanations, and four related problems.
[An Editor is available at the bottom of the page to write and execute the scripts.]
1. Sort Values of Three Variables
Write a C++ program to sort the values of three variables which contain any value (numbers and/or literals).
Click me to see the sample solution
2. Sort an Array Using the Bead Sort Algorithm
Write a C++ program to sort an array of positive integers using the Bead sort algorithm.
Click me to see the sample solution
3. Sort a List Using the Bogosort Algorithm
Write a C++ program to sort a list of numbers using the Bogosort algorithm.
Click me to see the sample solution
4. Sort an Array Using the Bubble Sort Algorithm
Write a C++ program to sort an array of elements using the Bubble sort algorithm.
Click me to see the sample solution
5. Sort an Array Using the Cocktail Sort Algorithm
Write a C++ program to sort an array of elements using the Cocktail sort algorithm.
Click me to see the sample solution
6. Sort an Array Using the Counting Sort Algorithm
Write a C++ program to sort an array of elements using the Counting sort algorithm.
Click me to see the sample solution
7. Sort an Array Using the Gnome Sort Algorithm
Write a C++ program to sort an array of elements using the Gnome sort algorithm.
Click me to see the sample solution
8. Sort an Array Using the Heapsort Algorithm
Write a C++ program to sort an array of elements using the Heapsort sort algorithm.
Click me to see the sample solution
9. Sort an Array Using the Insertion Sort Algorithm
Write a C++ program to sort an array of elements using the Insertion sort algorithm.
Click me to see the sample solution
10. Sort a Collection Using the Merge Sort Algorithm
Write a C++ program to sort a collection of integers using the Merge sort.
Click me to see the sample solution
11. Sort a Collection Using the Pancake Sort Algorithm
Write a C++ program to sort a collection of integers using Pancake sort.
Click me to see the sample solution
12. Sort a Collection Using the Quick Sort Algorithm
Write a C++ program to sort a collection of integers using Quick sort.
Click me to see the sample solution
13. Sort a Collection Using the Radix Sort Algorithm
Write a C++ program to sort a collection of integers using Radix sort.
Click me to see the sample solution
14. Sort a Collection Using the Selection Sort Algorithm
Write a C++ program to sort a collection of integers using Selection sort.
Click me to see the sample solution
CPP Code Editor:
More to Come !
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.