beingtopper.jkp@gmail.com
+91-7529019575
Free Demo

Being Topper

  • Home
  • About Us
    • Founder’s Profile
    • Franchise
    • Women’s Entrepreneurship Development
  • Blog & Events
  • Modules
    • Website Planning and Creation
    • Social Media Marketing Course
    • Search Engine Optimization
    • SEM/PPC Training
  • Branches
    • Rajasthan
      • Ajmer
      • Jaipur
      • Jodhpur
      • Udaipur
      • Kota
      • Sikar
    • Janakpuri
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us

Being Topper

  • Home
  • About Us
    • Founder’s Profile
    • Franchise
    • Women’s Entrepreneurship Development
  • Blog & Events
  • Modules
    • Website Planning and Creation
    • Social Media Marketing Course
    • Search Engine Optimization
    • SEM/PPC Training
  • Branches
    • Rajasthan
      • Ajmer
      • Jaipur
      • Jodhpur
      • Udaipur
      • Kota
      • Sikar
    • Janakpuri
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us
  • Home
  • About Us
    • Founder’s Profile
    • Franchise
    • Women’s Entrepreneurship Development
  • Blog & Events
  • Modules
    • Website Planning and Creation
    • Social Media Marketing Course
    • Search Engine Optimization
    • SEM/PPC Training
  • Branches
    • Rajasthan
      • Ajmer
      • Jaipur
      • Jodhpur
      • Udaipur
      • Kota
      • Sikar
    • Janakpuri
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us

Being Topper

  • Home
  • About Us
    • Founder’s Profile
    • Franchise
    • Women’s Entrepreneurship Development
  • Blog & Events
  • Modules
    • Website Planning and Creation
    • Social Media Marketing Course
    • Search Engine Optimization
    • SEM/PPC Training
  • Branches
    • Rajasthan
      • Ajmer
      • Jaipur
      • Jodhpur
      • Udaipur
      • Kota
      • Sikar
    • Janakpuri
    • Tilak Nagar
    • Noida
    • Chandigarh
    • Mumbai
  • Contact Us
Algorithm Design and analysis ProgramsB.tech notesC++ programInformation technology

C++ PROGRAM ON QUICK SORT

Being Topper Admin 24/05/2013 0 Comments

QUICK SORT

QuickSort algorithm works on  a Divide and Conquer technique. It select an element as pivot and splits the given array around the picked pivot. There are lots of different versions of quickSort that select pivot in different ways.

  1. Always pick first element as pivot.
  2. Always pick last element as pivot
  3. Pick a random element as pivot.
  4. Pick median as pivot.

The main process in quickSort is partition(). Target of partitions is, given an array and an element x of array as pivot, put x at its correct position in sorted array and put all smaller elements (smaller than x) before x, and put all greater elements (greater than x) after x. All this should be done in linear time.

 

check this video of Quick-sort with Hungarian folk dance


WRITE A PROGRAM ON QUICK -SORT
#include<iostream.h>

#include<conio.h>

#include<stdio.h>

int  partition(int arr[], int p,int r);

void  quicksort(int arr[],int p,int r)

{ int q;

if (p<r)

{  q= partition(arr,p,r);

quicksort(arr,p,q-1);

quicksort(arr,q+1,r);

}

int  partition(int  arr[],int  p, int r)

{    int t, k,y,i,x;

x=arr[r];

i=p-1;

for(j=p;j<r;j++)

{  if(arr[j]<=x)

{  i=i+1;

t=arr[i];

arr[i]=arr[j];

arr[j]= t;

}

}

k=arr[i+1];

arr[i+1]=arr[r];

arr[r]=k;

y = i+1;

return y  ; }

void main()

{

int arr[8],i;

cout<<“Enter array elements : \n”;

for(i=0;i<8 ;i++)

{  cin>>arr[i]; }

cout<<“\n The array elements are : \n”;

for(i=0;i<8;i++)

{   cout<<arr[i];  }

quicksort(arr,1,8);

cout<<” sorted array elements are :\n”;

for(i=0;i<8;i++)

cout<<  arr[i];

getch();

}
OUTPUT :

output

Algorithm and design analysis C++ PROGRAM ON QUICK SORT C++ PROGRAM ON QUICK SORT IMPLEMENTATION quick sort
AboutBeing Topper
"Being Topper, established in 2013, is a premier Digital Marketing Training institute Known for its specializing in digital marketing courses in Delhi. At Being Topper, our carefully crafted training programs are designed to offer learners the practical skills and knowledge essential for a thriving career in today's digital space. Led by certified professionals, the institute delivers top-rated courses that cover key areas, including Social Media Marketing, Pay-Per-Click advertising, content marketing and SEO. With hands-on projects and a focus on industry-specific practices, Being Topper prepares individuals to become effective digital marketing professionals, ready to excel in an increasingly digital-centric world
In Socials:
C++ PROGRAM FOR ACTIVITY SELECTOR25/05/2013Next

Related Posts

Algorithm Design and analysis ProgramsB.tech notesC++ programInformation technology

C++ PROGRAM ON QUICK SORT

QUICK SORT QuickSort algorithm works on  a Divide and Conquer technique. It select an...

Being Topper Admin 24/05/2013
B.tech notesBCA NOTESInformation technologyJava ProgramsPrograms/Algorithm

java program to make a GUI based calculator using frames

we are going to make a calculator’s gui … (more…)

Being Topper Admin 01/04/2014
Categories
Recent Posts
  • Vipin Khuttel Inspires Entrepreneurs at Networking Meet in Gurgaon
  • Vipin Khuttel Founder of Being Topper Recognized for Advancing Digital Literacy and Social Empowerment
  • Vipin Khuttel Organizes International Conference for Digital Excellence 2, Elevating the Future of Technology
  • India’s Top Occult Science Enthusiasts Gather at AgyatOnSearch – Awards & Seminar in New Delhi
  • India’s Leading Digital Marketer, Vipin Khuttel Interacted with Top Influencers of Delhi at BJP West Delhi’s Event

Copyright © 2025 Being Topper ® . All Rights Reserved