forked from srbcheema1/Algo_Ds
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Added Merge sort #1
Open
siddharthnarula
wants to merge
43
commits into
Mukesh-BR:master
Choose a base branch
from
1siddhi7:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Update Readme
* Added Reverse_Queue.cpp * Update stack.hpp
i am adding merge sort coded in java.
* Create Kosaraju_algorithm The Kosaraju algorithm is an important graph algorithm to detect strongly connected components in a graph. A directed graph is strongly connected if there is a path between all pairs of vertices. A strongly connected component (SCC) of a directed graph is a maximal strongly connected subgraph. This algorithm is often the first step in solving many graph questions. * Create Dynamic_fibonacci.py
* Create square_root_decomposition * Create travelling_salesman_problem * Add files via upload
* Add Segment Tree Java * Add Segment Tree with Lazy Propagation Java * Add Binary Search Tree Java
* Create createBST.cpp * Create bucketsort.c
To find the longest increasing subsequence in an array of integers.
* Adding Linear/Binary search in java packages * Adding further instructions in TODO file.
* OS scheduling algorithms * OS scheduling algorithms
* Create bubblesort.cpp * Create Stack_as_linked_list.cpp
…cheema1#169) * Create bfs.cpp * Create BFS.py * Rename bfs.cpp to BFS.cpp * Update BFS.cpp This is a Breadth First Search Code in C++ language. An exemplary graph is made in the main() function and starting is done from 2nd vertex.(can be changed as per the requirement). * BFS Algorithm added to graph folder
* added an efficient median search algo * btree code added
QucikSort using python
Full code of merge sort in python3 with an example. Also provided the time and space complexity.
* added quick sort in python3 * binary search in python3
Greedy choice property used : Take the item which gives maximum profit whenever possible
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#include
#include<conio.h>
#include<dos.h>
#include<time.h>
#include<stdlib.h>
#include<windows.h>
using namespace std;
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
}
/* l is for left index and r is right index of the
sub-array of arr to be sorted */
void mergeSort(int arr[], int l, int r)
{
if (l < r)
{ Sleep(1000);
// Same as (l+r)/2, but avoids overflow for
// large l and h
int m = l+(r-l)/2;
}
void printArray(int arr[], int size)
{
int i;
for (i = 0; i < size; i++)
cout << arr[i] << " ";
cout << endl;
}
int main()
{
clock_t start,end;
int arr[100],n=25;
for(int i=0;i<n;i++)
{
arr[i] = (rand()%100+1);
cout << arr[i] << endl;
}
//int n = sizeof(arr)/sizeof(arr[0]);
start=clock();
mergeSort(arr,0,n);
end=clock();
cout<<"Sorted array: \n";
printArray(arr, n);
float t=(end-start)/CLK_TCK;
cout<<"\n Time Taken is"<<t;
return 0;
}