From 9ee176d2826a0940490634a2e9c5f8202b853d29 Mon Sep 17 00:00:00 2001 From: sahil261997 Date: Sat, 21 Oct 2017 21:46:15 +1100 Subject: [PATCH 1/5] Add:Bubble Sort --- C/Sort/bubble_sort.c | 130 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 C/Sort/bubble_sort.c diff --git a/C/Sort/bubble_sort.c b/C/Sort/bubble_sort.c new file mode 100644 index 0000000..96079b3 --- /dev/null +++ b/C/Sort/bubble_sort.c @@ -0,0 +1,130 @@ +//Bubble Sort... + +//Author : Mast Ram Sharma +//Date : 16/10/17 + +#include +#include +void manually(int *,int ); +void automatically(int *,int ); +int* sort(int *,int ); +void display(int *,int ); +void compare(int *,int *,int ); +int main() +{ + int size,choice; + //Size Of Orignal Array + printf("Enter The Size Of The Arrey :"); + scanf("%d",&size); + int *arr; + arr=(int*)malloc(size*sizeof(int)); + //To Get The Values Of Unsorted Array + printf("\nEnter The Values :\n"); + for(int i=0 ;i arr[j+1]) + { + temp=arr[j]; + arr[j]=arr[j+1]; + arr[j+1]=temp; + swap++; + } + } + } + + return arr; +} + +//Function To Display Array.. + +void display(int *arr,int size) +{ + printf("\nArray = "); + for(int i=0 ;i Date: Sun, 22 Oct 2017 01:53:56 +1100 Subject: [PATCH 2/5] EDITED :CONTRIBUTERS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index aef6163..c6e01be 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -5,3 +5,4 @@ Sumit Gupta(Invincisumit) Shifali Gupta (Gupta-shifali) Mohit Sharma (ms10398) Harshit Luthra (sachincool) +Mast Ram Sharma(sahil261997) From d127d7870237550de1548dfd9373a8bb3d76bac4 Mon Sep 17 00:00:00 2001 From: sahil261997 Date: Sun, 22 Oct 2017 02:01:09 +1100 Subject: [PATCH 3/5] ADD : Insertion Sort --- C/Sort/insertion_sort.c | 128 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 C/Sort/insertion_sort.c diff --git a/C/Sort/insertion_sort.c b/C/Sort/insertion_sort.c new file mode 100644 index 0000000..02d57eb --- /dev/null +++ b/C/Sort/insertion_sort.c @@ -0,0 +1,128 @@ +//Insertion Sort... + +//Author : Mast Ram Sharma +//Date : 16/10/17 + +#include +#include +void manually(int *,int ); +void automatically(int *,int ); +int* sort(int *,int ); +void display(int *,int ); +void compare(int *,int *,int ); +int main() +{ + int size,choice; + //Size Of Orignal Array + printf("Enter The Size Of The Arrey :"); + scanf("%d",&size); + int *arr; + arr=(int*)malloc(size*sizeof(int)); + //To Get The Values Of Unsorted Array + printf("\nEnter The Values :\n"); + for(int i=0 ;i=0 && arr[j]>num) + { + arr[j+1]=arr[j]; + j=j-1; + } + arr[j+1]=num; + } + + return arr; +} + +//Function To Display Array.. + +void display(int *arr,int size) +{ + printf("\nArray = "); + for(int i=0 ;i Date: Sun, 22 Oct 2017 02:11:32 +1100 Subject: [PATCH 4/5] ADD :Selection Sort --- C/Sort/selection_sort.c | 133 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 C/Sort/selection_sort.c diff --git a/C/Sort/selection_sort.c b/C/Sort/selection_sort.c new file mode 100644 index 0000000..5583961 --- /dev/null +++ b/C/Sort/selection_sort.c @@ -0,0 +1,133 @@ +//Selection Sort... + +//Author : Mast Ram Sharma +//Date : 16/10/17 + +#include +#include +void manually(int *,int ); +void automatically(int *,int ); +int* sort(int *,int ); +void display(int *,int ); +void compare(int *,int *,int ); +int main() +{ + int size,choice; + //Size Of Orignal Array + printf("Enter The Size Of The Arrey :"); + scanf("%d",&size); + int *arr; + arr=(int*)malloc(size*sizeof(int)); + //To Get The Values Of Unsorted Array + printf("\nEnter The Values :\n"); + for(int i=0 ;i Date: Sun, 22 Oct 2017 03:43:17 +1100 Subject: [PATCH 5/5] ADD :Lexicographical Order --- C/Sort/lexicographical_order.c | 44 ++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 C/Sort/lexicographical_order.c diff --git a/C/Sort/lexicographical_order.c b/C/Sort/lexicographical_order.c new file mode 100644 index 0000000..b67f7a3 --- /dev/null +++ b/C/Sort/lexicographical_order.c @@ -0,0 +1,44 @@ +//Lexicographical Order.. + +//Author :Mast Ram Sharma +//Date :17/10/19 + + +#include +#include +int main() +{ + int num; + //num= No. Of Name Or Strings User Wnt To Enter.. + printf("Enter The Number Of Strings You Want To Enter :"); + scanf("%d",&num); + char str[num][100],temp[100]; + //Input Of The Strings.. + printf("Enter %d Words :",num); + for(int i=0 ;i0) + { + strcpy(temp,str[i]); + strcpy(str[i],str[j]); + strcpy(str[j],temp); + } + } + } +//Printing Of The String In Lexicographical Order.. + printf("\n\nLexicographical order....\n"); + for(int i=0;i