Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
Core Java and Java 8
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Lokesh Singh
Core Java and Java 8
Commits
a639c633
Unverified
Commit
a639c633
authored
Jan 08, 2022
by
Lokesh Singh
Committed by
GitHub
Jan 08, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create Quick sort
parent
b75f94e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
Quick sort
Quick sort
+36
-0
No files found.
Quick sort
0 → 100644
View file @
a639c633
static void quickSort(int arr[], int low, int high)
{
// code here
// if(low == high)
// return arr;
if(low<high)
{ int m = partition(arr, low, high);
quickSort(arr, low, m-1);
quickSort(arr, m+1, high);
// return arr;
}
}
static int partition(int arr[], int low, int high)
{
// your code here
int p = low;
int q = high;
int x = arr[p];
int i = p;
for (int j = p+1; j<=high; j++)
{
if(arr[j]<=x)
{
i++;
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
// swap(arr[i],arr[p]);
int temp = arr[i];
arr[i] = arr[p];
arr[p] = temp;
return i;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment