-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the files and removed the duplicates
- Loading branch information
1 parent
1d8d6f8
commit fa849ef
Showing
30 changed files
with
203 additions
and
144 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 1 addition & 3 deletions
4
InsertionSort-Java/InsertionSort-Java.iml → .idea/sorting-algorithms.iml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
# include <stdio.h> | ||
int main(void) | ||
{ | ||
int ar[10], key, i, j; | ||
printf ("Enter 10 numbers: \n"); | ||
for (i=0; i<10; i++) | ||
scanf ("%d", &ar[i]); | ||
for (i=1; i<10; i++) | ||
{ | ||
key = ar[i]; | ||
j = i-1; | ||
while (j>=0 && ar[j]>key) | ||
{ | ||
ar[j+1] = ar[j]; | ||
j = j-1; | ||
} | ||
ar[j+1] = key; | ||
} | ||
printf ("The Sorted array:\n"); | ||
for (i=0; i<10; i++) | ||
printf ("ar[%d] = %d\n", i, ar[i]); | ||
return 0; | ||
} | ||
# include <stdio.h> | ||
int main(void) | ||
{ | ||
int ar[10], key, i, j; | ||
printf ("Enter 10 numbers: \n"); | ||
for (i=0; i<10; i++) | ||
scanf ("%d", &ar[i]); | ||
for (i=1; i<10; i++) | ||
{ | ||
key = ar[i]; | ||
j = i-1; | ||
while (j>=0 && ar[j]>key) | ||
{ | ||
ar[j+1] = ar[j]; | ||
j = j-1; | ||
} | ||
ar[j+1] = key; | ||
} | ||
printf ("The Sorted array:\n"); | ||
for (i=0; i<10; i++) | ||
printf ("ar[%d] = %d\n", i, ar[i]); | ||
return 0; | ||
} |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
# include <stdio.h> | ||
#define MAX 1000 | ||
int main(void) | ||
{ | ||
int i, j, N, pos, temp; | ||
int ar[MAX]; | ||
printf ("Enter the number of integers to sort:"); | ||
scanf ("%d", &N); | ||
printf ("Enter the integers: \n"); | ||
for (i=0; i<N; i++) | ||
scanf ("%d", &ar[i]); | ||
for(i=0; i<N-1; i++) | ||
{ | ||
pos = i; | ||
for (j=i+1; j<N; j++) | ||
{ | ||
if (ar[j]<ar[pos]) | ||
{ | ||
pos = j; | ||
} | ||
} | ||
temp = ar[pos]; | ||
ar[pos]=ar[i]; | ||
ar[i]=temp; | ||
} | ||
printf ("The sorted array : \n"); | ||
for (i=0; i<N; i++) | ||
printf ("ar[%d] = %d \n", i, ar[i]); | ||
return 0; | ||
} | ||
# include <stdio.h> | ||
#define MAX 1000 | ||
int main(void) | ||
{ | ||
int i, j, N, pos, temp; | ||
int ar[MAX]; | ||
printf ("Enter the number of integers to sort:"); | ||
scanf ("%d", &N); | ||
printf ("Enter the integers: \n"); | ||
for (i=0; i<N; i++) | ||
scanf ("%d", &ar[i]); | ||
for(i=0; i<N-1; i++) | ||
{ | ||
pos = i; | ||
for (j=i+1; j<N; j++) | ||
{ | ||
if (ar[j]<ar[pos]) | ||
{ | ||
pos = j; | ||
} | ||
} | ||
temp = ar[pos]; | ||
ar[pos]=ar[i]; | ||
ar[i]=temp; | ||
} | ||
printf ("The sorted array : \n"); | ||
for (i=0; i<N; i++) | ||
printf ("ar[%d] = %d \n", i, ar[i]); | ||
return 0; | ||
} |
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...edBubbleSort-Java/ImprovedBubbleSort.java → Java/BubbleSort.java
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 18 additions & 18 deletions
36
SelectionSort-Python/SelectionSort.py → Python/SelectionSort.py
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
def selectionSort(l): | ||
for start in range(len(l)): | ||
|
||
#assign start value as minimum value | ||
minpos=start | ||
|
||
for i in range(start,len(l)): | ||
if(l[i]<l[minpos]): | ||
minpos=i | ||
|
||
(l[start],l[minpos]) = (l[minpos],l[start]) | ||
|
||
|
||
if __name__ == "__main__": | ||
print('Enter sequence(separated by spaces): ') | ||
arr=[int(x) for x in input().split()] | ||
selectionSort(arr) | ||
print(arr) | ||
def selectionSort(l): | ||
for start in range(len(l)): | ||
|
||
#assign start value as minimum value | ||
minpos=start | ||
|
||
for i in range(start,len(l)): | ||
if(l[i]<l[minpos]): | ||
minpos=i | ||
|
||
(l[start],l[minpos]) = (l[minpos],l[start]) | ||
|
||
|
||
if __name__ == "__main__": | ||
print('Enter sequence(separated by spaces): ') | ||
arr=[int(x) for x in input().split()] | ||
selectionSort(arr) | ||
print(arr) |
Binary file not shown.
This file was deleted.
Oops, something went wrong.