Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manjeet: add algorithm quick sort #367

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Algorithms/quickSort.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include<iostream>
using namespace std;

class Solution
{
public:
//Function to sort an array using quick sort algorithm.
void quickSort(int arr[], int low, int high)
{
// code here
if(low < high) {
int pindx = partition(arr, low, high);

quickSort(arr, low, pindx - 1);
quickSort(arr, pindx + 1, high);
}
}

public:
int partition (int arr[], int low, int high)
{
// Your code here
int pivot = arr[high];
int i = low - 1;

for(int j = low; j < high; j++) {
if(arr[j] < pivot) {
i++; //swap
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}

i++;
int temp = arr[i];
arr[i] = pivot;
arr[high] = temp;

return i;
}
};
11 changes: 9 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,12 @@

- Place: Pakistan, Islamabad
- Bio: Software Engineer | MERN Stack Developer | Beta LSA @ Microsoft
- Affiliation : Air University
- GitHub: [Abdul Rehan](https://github.com/abrehan2)
- Affiliation: Air University
- GitHub: [Abdul Rehan](https://github.com/abrehan2)

#### Name: [Manjeet Sharma](https://www.linkedin.com/in/manjeet-sharma-338868214/)

- Place: India, Kolkata
- Bio: CSE Student | Full Stack Developer
- Affiliation: Sister Nivedita University
- GitHub: [Manjeet Sharma](https://github.com/manjeetsharma0796)
28 changes: 28 additions & 0 deletions Profiles/manjeet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Manjeet Sharma

### Location

India, Kolkata

### Academics

Sister Nivedita University

### Interests

- Like to listen music
- Binge watch movies
- Like to discuss and code

### Development

- Didn't invented yet

### Projects

- [Todo App](https://github.com/manjeetsharma0796/todo) A simple list of todo with category
- [Wordle](https://github.com/manjeetsharma0796/wordle) A word guessing game

### Profile Link

[Manjeet Sharma](https://github.com/manjeetsharma0796)
7 changes: 7 additions & 0 deletions Scripts/manjeetsharma.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// LANGUAGE: Javascript
// AUTHOR: Manjeet Sharma
// GITHUB: https://github.com/manjeetsharma0796

// # This program is in JSON

console.log('Hello, Hacktoberfest 2023!');