Inspiration
C++ is one of the most useful programming language and has many applications. As a part of Global Hack Week Challenge, I have written the code using C++.
What it does
Quicksort is a sorting algorithm which uses the divide-and-overcome approach . It divides an array into sub-arrays, one with elements smaller than a specific pivot element and the opposite with elements identical to or larger than the pivot. The technique is then repeated for the sub-arrays till the whole array has been sorted.
How we built it
Here Integer pivot refers to the pivot element(the sub-array's middle element). I have used while loop and if statements to check and perform sorting. After swapping, the two ensuing sub-arrays are sorted recursively using the Quicksort function.
Challenges we ran into
The code was not running due to TLE error initially. After putting swap, it ran successfully.
Accomplishments that we're proud of
We have got the ascending sorted list after running the code and the TLE error has been eliminated.
What we learned
We have learned the usage of quicksort() function, the time and space complexity, eliminating TLE error using std::swap.
What's next for Code to Sort a list in C++ Language
Quicksort is widely used way of sorting and this code syntax can be used to solve further problems.
Built With
- c++
- quicksort
- visual-studio
Log in or sign up for Devpost to join the conversation.