C++ Sorting and Searching: Exercises, Practice, Solution
C++ Sorting and Searching [14 exercises with solution]
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]
1. 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. Write a C++ program to sort an array of positive integers using the Bead sort algorithm.
Click me to see the sample solution
3. Write a C++ program to sort a list of numbers using the Bogosort algorithm.
Click me to see the sample solution
4. Write a C++ program to sort an array of elements using the Bubble sort algorithm.
Click me to see the sample solution
5. Write a C++ program to sort an array of elements using the Cocktail sort algorithm.
Click me to see the sample solution
6. Write a C++ program to sort an array of elements using the Counting sort algorithm.
Click me to see the sample solution
7. Write a C++ program to sort an array of elements using the Gnome sort algorithm.
Click me to see the sample solution
8. Write a C++ program to sort an array of elements using the Heapsort sort algorithm.
Click me to see the sample solution
9. Write a C++ program to sort an array of elements using the Insertion sort algorithm.
Click me to see the sample solution
10. Write a C++ program to sort a collection of integers using the Merge sort.
Click me to see the sample solution
11. Write a C++ program to sort a collection of integers using Pancake sort.
Click me to see the sample solution
12. Write a C++ program to sort a collection of integers using Quick sort.
Click me to see the sample solution
13. Write a C++ program to sort a collection of integers using Radix sort.
Click me to see the sample solution
14. 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.
C++ Programming: Tips of the Day
Why is there no std::stou?
The most pat answer would be that the C library has no corresponding "strtou", and the C++11 string functions are all just thinly veiled wrappers around the C library functions: The std::sto* functions mirror strto*, and the std::to_string functions use sprintf.
Ref: https://bit.ly/3wtz2qA
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook