From a13be31aa3cfeb71a331adc8ad4a30ce88c99c06 Mon Sep 17 00:00:00 2001 From: rattle99 <24495512+rattle99@users.noreply.github.com> Date: Tue, 2 Oct 2018 12:00:08 +0530 Subject: [PATCH 1/2] add quicksort --- Sorting/quickSort/quick.cpp | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 Sorting/quickSort/quick.cpp diff --git a/Sorting/quickSort/quick.cpp b/Sorting/quickSort/quick.cpp new file mode 100644 index 000000000..c45305ace --- /dev/null +++ b/Sorting/quickSort/quick.cpp @@ -0,0 +1,64 @@ +/*Program for quick sort implementation in C++. */ + +#include +#include + +int partition(std::vector &A, int start, int end) +{ + int temp; + int pivot = A[end]; + int partitionIndex = start; // set partition index as start initially + for(int i=start; i quick_sort(std::vector &A, int start, int end) +{ +/* std::cout<<"Current list : \n"; + for(int i=0;i arr={10,2,23,-4,235,56,2,6,5,5,5,23,-4,346,-56,81,43,654,435,-54}; + quick_sort(arr, 0, arr.size()-1); + std::cout<<"\n\n\n"; + for(int i=0;i Date: Tue, 2 Oct 2018 12:08:56 +0530 Subject: [PATCH 2/2] fixes #31 --- ... queue => menu-driven-stack-and-queue.cpp} | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) rename data structures/{menu driven stack and queue => menu-driven-stack-and-queue.cpp} (97%) diff --git a/data structures/menu driven stack and queue b/data structures/menu-driven-stack-and-queue.cpp similarity index 97% rename from data structures/menu driven stack and queue rename to data structures/menu-driven-stack-and-queue.cpp index b1ccca3c0..ff6b858d2 100644 --- a/data structures/menu driven stack and queue +++ b/data structures/menu-driven-stack-and-queue.cpp @@ -1,6 +1,6 @@ #include #include -#include + using namespace std; void stck(); @@ -47,7 +47,7 @@ void stck_ins_arr() st[top] = data; } cout << "\nElement inserted succesfully\n"; - getch(); + getchar(); stck(); } @@ -63,7 +63,7 @@ void stck_del_arr() top--; cout << "\nElement deleted succesfully\n"; } - getch(); + getchar(); stck(); } void stck_print() @@ -88,7 +88,7 @@ void stck_print() << "\n"; } } - getch(); + getchar(); stck(); } void stck() @@ -136,7 +136,7 @@ void que_ins_arr() cout << "\nElement inserted succesfully\n"; - getch(); + getchar(); que(); } void que_del_arr() @@ -153,7 +153,7 @@ void que_del_arr() cout << "\nElement deleted succesfully\n"; } - getch(); + getchar(); que(); } void que_print() @@ -166,7 +166,7 @@ void que_print() cout << q[i] << " | "; } - getch(); + getchar(); que(); } void que() @@ -214,7 +214,7 @@ void stck_ins_list() head = temp; } cout << "\nElement insereted successfully\n"; - getch(); + getchar(); stck_list(); } void stck_del_list() @@ -232,7 +232,7 @@ void stck_del_list() free(temp); } cout << "\nElement deleted succesfully!!\n"; - getch(); + getchar(); stck_list(); } void stck_print_list() @@ -258,7 +258,7 @@ void stck_print_list() temp = temp->next; } } - getch(); + getchar(); stck_list(); } @@ -307,7 +307,7 @@ void que_ins_list() head = temp; } cout << "\nElement inserted succesfully\n"; - getch(); + getchar(); que_list(); } void que_del_list() @@ -339,7 +339,7 @@ void que_del_list() temp1->next = NULL; } cout << "\nElement deleted succesfully!!\n"; - getch(); + getchar(); que_list(); } void que_print_list() @@ -362,7 +362,7 @@ void que_print_list() temp = temp->next; } } - getch(); + getchar(); que_list(); }