• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
projectsgeek

ProjectsGeek

Download Mini projects with Source Code, Java projects with Source Codes

  • Home
  • Java Projects
  • C++ Projects
  • VB Projects
  • PHP projects
  • .Net Projects
  • NodeJs Projects
  • Android Projects
    • Project Ideas
      • Final Year Project Ideas
      • JSP Projects
  • Assignment Codes
    • Fundamentals of Programming Language
    • Software Design Laboratory
    • Data Structure and Files Lab
    • Computer Graphics Lab
    • Object Oriented Programming Lab
    • Assembly Codes
  • School Projects
  • Forum

Quick sort using recursion

June 26, 2011 by ProjectsGeek Leave a Comment

Implement Quick sort using recursion

 

In this post we will see how to implement quick sort using recursion in c/c++. Quick sort is simple and efficient algorithm for sorting items in array or elements in array. Its is very common algorithm used for sorting and asked in interviews as well.

Quick sort using recursion

Features of Quick sort

  • Worst-case performance‎: ‎O(n2)
  • Average performance‎: ‎O(n log n)
  • Best-case performance‎: ‎O(n log n)
Quick sort using recursion work is such as way that we need to select a pivot element. Now reorder the elements which are less than pivot should come before pivot. Similarly elements which are greater than pivot will come after selected pivot element. We need to repeat this process recursively on the element array.
Beyond this below implementation we have many different types of quick sorts available which are more efficient is specific scenarios.

Quick sort source code

#include
#include
void quick_sort(int [],int,int);
int partition(int [],int,int);
void main()
{
int a[30],n,i,op;
clrscr();
do
{
printf("\n1)Quick Sort\n2)Quit");
printf("\nEnter your choice : ");
scanf("%d",&op);
if(op==1)
{
printf("\nEnter no of elements :");
scanf("%d",&n);
printf("\nEnter array elements :");
for(i=0;i<=u);do
{ j--;
}while(a[j]>v);

if(i)>;i++)>

Quick sort using recursion Output

1)Quick Sort
2)Quit
Enter your choice : 1

Enter no of elements :6

Enter array elements :60 33 70 84 21 50

Sorted array is :21 33 50 60 70 84
1)Quick Sort
2)Quit
Enter your choice : 2

);>)>)>;i++)>

Other Projects to Try:

  1. Matrix Operations with Pointers
  2. Mobile User Information Project
  3. Set operations – Union, Intersection, Difference, Symmetric Difference using C
  4. Sparse Matrix Operations Code using C Langauge
  5. Factorial of a number using recursion in C

Filed Under: Fundamentals of Datastructure Tagged With: Datastructure Assignments

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Tags

.Net Projects Download Android Project Ideas Android Projects Angular 2 Assembly Codes C # Projects C & C++ Projects C++ Projects Class Diagrams Computer Graphics Database Project Data Mining Projects DataScience Projects Datastructure Assignments Download Visual Basic Projects Electronics project Hadoop Projects Installation Guides Internet of Things Project IOS Projects Java Java Interview Questions Java Projects JavaScript JavaScript Projects java tutorial JSON JSP Projects Mechanical Projects Mongodb Networking Projects Node JS Projects OS Problems php Projects Placement Papers Project Ideas Python Projects seminar and presentation Struts

Search this Website


Footer

Download Java Project
Download Visual Basic Projects
Download .Net Projects
Download VB Projects
Download C++ Projects
Download NodeJs Projects
Download School Projects
Download School Projects
Ask Questions - Forum
Latest Projects Ideas
Assembly Codes
Datastructure Assignments
Computer Graphics Lab
Operating system Lab
australia-and-India-flag
  • Home
  • About me
  • Contact Form
  • Submit Your Work
  • Site Map
  • Privacy Policy