Skip to content

Various Sorting techniques' implementation in C++

Notifications You must be signed in to change notification settings

Zeekinger/quicksort

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

SORTING NUMBER 1 : QUICKSORT

What is Quick Sort ?

Quicksort partitions an array and then calls itself recursively twice to sort the two resulting subarrays. This algorithm is quite efficient for large-sized data sets as its average and worst-case complexity are O(nLogn) and image.png(n2), respectively.

Quick Sort implementation in C++

Implemented Using vectors in C++ in Codeblocks Ide (MinGW gcc compiler)

Header Files Included:

 -> iostream
 -> vector

Functions:

=> swapp(vector<int>,int,int) 
    ->Swap 2 values of the array(index of elements as parameters)

=> partition
    -> returns the index of correct position of pivot element passed
    
=> quicksort
    ->Recursive function to do the sorting on partitioned vectors
  
=> main
    ->Get the vector from the user, calls the quicksort function on the vector and displays the sorted vector.

About

Various Sorting techniques' implementation in C++

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%