From e31c6afeb2c9d159ea88bf1b8475fb4580aa5899 Mon Sep 17 00:00:00 2001 From: Sagar Sharma <78422995+Sagar-Sharma-7@users.noreply.github.com> Date: Fri, 13 May 2022 16:16:48 +0530 Subject: [PATCH 1/4] Create CONTRIBUTING.md --- CONTRIBUTING.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..dba7750 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,15 @@ +# Contributing + +When contributing to this repository, please first discuss the change you wish to make via issue, +email, or any other method with the owners of this repository before making a change. + +Please note we have a code of conduct, please follow it in all your interactions with the project. + +## Any contributions you make will be under the MIT Software License +In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. + +## Report bugs using Github's [issues](https://github.com/Sagar-Sharma-7/Python-list-sorting-algorithms/issues) +We use GitHub issues to track public bugs. Report a bug by opening a new issue; it's that easy! + +## Owner Of the Repository - Sagar Sharma +[Sagar Sharma](https://github.com/Sagar-Sharma-7) From 231d3bca8231a1ff0950bb187d3995f4d14af010 Mon Sep 17 00:00:00 2001 From: Sagar-Sharma-7 <6969sagarsharma@gmail.com> Date: Sat, 14 May 2022 19:45:30 +0530 Subject: [PATCH 2/4] added selection sorting algorithm --- algorithms/app2.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 algorithms/app2.py diff --git a/algorithms/app2.py b/algorithms/app2.py new file mode 100644 index 0000000..5df8190 --- /dev/null +++ b/algorithms/app2.py @@ -0,0 +1,14 @@ +# Selection sorting +l = eval(input("Enter your number list: ")) +n = len(l) +for i in range(0, n): + min = i + f = False + for j in range(i + 1, n): + if l[j] < l[min]: + min = j + f = True + if f == True: + l[i], l[min] = l[min], l[i] + print(l) + \ No newline at end of file From f8f8ab9bee084c1c0001b7739daea273aabc5551 Mon Sep 17 00:00:00 2001 From: Sagar-Sharma-7 <6969sagarsharma@gmail.com> Date: Wed, 18 May 2022 13:02:03 +0530 Subject: [PATCH 3/4] insertion sorting algorithm --- algorithms/app2.py | 3 ++- algorithms/app3.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 algorithms/app3.py diff --git a/algorithms/app2.py b/algorithms/app2.py index 5df8190..e003af9 100644 --- a/algorithms/app2.py +++ b/algorithms/app2.py @@ -11,4 +11,5 @@ if f == True: l[i], l[min] = l[min], l[i] print(l) - \ No newline at end of file + +print("Sorted list: ", l) \ No newline at end of file diff --git a/algorithms/app3.py b/algorithms/app3.py new file mode 100644 index 0000000..c0eefee --- /dev/null +++ b/algorithms/app3.py @@ -0,0 +1,13 @@ +# Insertion sorting +l = eval(input("Enter your number list: ")) +n = len(l) +for i in range(n): + t = l[i] + k = i - 1 + while k >=0 and l[k] > t: + l[k + 1] = l[k] + k = k- 1 + l[k + 1] = t + print(l) + +print("Sorted list: ", l) From 175bdb1a6efd6c5b90a8e4da695ff67c587d1456 Mon Sep 17 00:00:00 2001 From: Sagar Sharma <78422995+Sagar-Sharma-7@users.noreply.github.com> Date: Thu, 22 Sep 2022 17:48:55 +0530 Subject: [PATCH 4/4] Create README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..88dcd8d --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# Python-list-sorting-algorithms +Contains easy and short python list sorting algorithms ( Only for numbers as per now)