From 1f921dea883802ab77883b4af86d9ef386f4c30d Mon Sep 17 00:00:00 2001 From: "Udaya Kumar.R" Date: Sat, 19 Oct 2019 12:53:27 +0530 Subject: [PATCH 1/4] fixed broken links, added animation link --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4bbb619..bb28fd1 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,8 @@ 5. [Quick Sort](#quick-sort) 6. [Selection Sort](#selection-sort) +[Animation of various sorting Algorithms](https://visualgo.net/bn/sorting) + ## Bubble Sort Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. * [Wikipedia](https://en.wikipedia.org/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvQnViYmxlX3NvcnQ) @@ -38,7 +40,7 @@ Like QuickSort, Merge Sort is a Divide and Conquer algorithm. It divides input a * [Wikipedia](https://en.wikipedia.org/wiki/Merge_sort) * [GeeksForGeeks](http://www.geeksforgeeks.org/merge-sort/)

-  merge +  merge

## Quick Sort @@ -49,10 +51,10 @@ Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an elemen -Pick a random element as pivot. -Pick median as pivot. The key 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. -* [Wikipedia](https://en.wikipedia.org/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvUXVpY2tzb3J0) +* [Wikipedia](https://en.wikipedia.org/wiki/Quicksort) * [GeeksForGeeks](http://www.geeksforgeeks.org/quick-sort/)

-  quick +  quick

## Selection Sort From 6779f18ff6dbf7895811f130207222b4297540a5 Mon Sep 17 00:00:00 2001 From: tuxuday5 <49431903+tuxuday5@users.noreply.github.com> Date: Sat, 19 Oct 2019 13:14:36 +0530 Subject: [PATCH 2/4] updated readme & formatted updated readme & formatted --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bb28fd1..935d3c3 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ 5. [Quick Sort](#quick-sort) 6. [Selection Sort](#selection-sort) -[Animation of various sorting Algorithms](https://visualgo.net/bn/sorting) +**[Animation of various sorting Algorithms](https://visualgo.net/bn/sorting)** ## Bubble Sort Bubble Sort is the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order. @@ -24,7 +24,7 @@ Heap sort is a comparison based sorting technique based on Binary Heap data stru * [Wikipedia](https://en.0wikipedia.org/index.php?q=aHR0cHM6Ly9lbi53aWtpcGVkaWEub3JnL3dpa2kvSGVhcHNvcnQ) * [GeeksForGeeks](http://www.geeksforgeeks.org/heap-sort/)

- heap + heap

## Insertion Sort From 87620b10c1eca01f93d6b2a2977f31e1d9e603e6 Mon Sep 17 00:00:00 2001 From: tuxuday5 <49431903+tuxuday5@users.noreply.github.com> Date: Sat, 19 Oct 2019 13:17:29 +0530 Subject: [PATCH 3/4] update readme update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 935d3c3..65dada9 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ The key process in quickSort is partition(). Target of partitions is, given an a * [Wikipedia](https://en.wikipedia.org/wiki/Quicksort) * [GeeksForGeeks](http://www.geeksforgeeks.org/quick-sort/)

-  quick +  quick

## Selection Sort From e704f96cc3a7e120fc1c6bde92aab4a2b9723417 Mon Sep 17 00:00:00 2001 From: "Udaya Kumar.R" Date: Sat, 19 Oct 2019 14:09:59 +0530 Subject: [PATCH 4/4] adding makefile & modified insertionsort.cpp selectionsort.cpp, to do away with windows only headers! --- codes/Makefile | 31 +++++++++++++++++++++++++++++++ codes/insertionsort.cpp | 11 +++++------ codes/selectionsort.cpp | 6 +++--- 3 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 codes/Makefile diff --git a/codes/Makefile b/codes/Makefile new file mode 100644 index 0000000..8473314 --- /dev/null +++ b/codes/Makefile @@ -0,0 +1,31 @@ +all: binary_search bubblesort heapsort insertionsort linear_search mergesort qsort selectionsort + +CC=g++ +CFLAGS=-Wall -c + +binary_search.o: binary_search.cpp + $(CC) $(CFLAGS) binary_search.cpp + +bubblesort.o: bubblesort.cpp + $(CC) $(CFLAGS) bubblesort.cpp + +heapsort.o: heapsort.cpp + $(CC) $(CFLAGS) heapsort.cpp + +insertionsort.o: insertionsort.cpp + $(CC) $(CFLAGS) insertionsort.cpp + +linear_search.o: linear_search.cpp + $(CC) $(CFLAGS) linear_search.cpp + +mergesort.o: mergesort.cpp + $(CC) $(CFLAGS) mergesort.cpp + +qsort.o: qsort.cpp + $(CC) $(CFLAGS) qsort.cpp + +selectionsort.o: selectionsort.cpp + $(CC) $(CFLAGS) selectionsort.cpp + +clean: + rm -f *.o binary_search bubblesort heapsort insertionsort linear_search mergesort qsort selectionsort diff --git a/codes/insertionsort.cpp b/codes/insertionsort.cpp index 2cc347c..82e86bf 100644 --- a/codes/insertionsort.cpp +++ b/codes/insertionsort.cpp @@ -1,10 +1,10 @@ /* C++ Program - Insertion Sort */ -#include -#include -void main() +#include + +using namespace std; +int main() { - clrscr(); int size, arr[50], i, j, temp; cout<<"Enter Array Size : "; cin>>size; @@ -30,5 +30,4 @@ void main() { cout< -#include -void main() +using namespace std; +int main() { int a[50], n,i,j; cout<<"\nEnter the size of list: "; @@ -19,5 +19,5 @@ void main() } cout<<"\nArranged list is: "; for(i=0; i