-
-
Notifications
You must be signed in to change notification settings - Fork 45.7k
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
Fixes wiki and doctest issues #11227
base: master
Are you sure you want to change the base?
Changes from 5 commits
76dec73
cc28eed
7d55e21
553eb82
c786649
aae2164
9c0424c
aa5885e
655419a
24b3d42
d8b299d
72c1ae3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Python Algorithms | ||
- All the algorithms are implemented in **Python** for **education purpose** only.<br> | ||
- These are just for **demonstration** purpose.<br> | ||
- There are many implementations of different algorithms in the Python standard library that are much better for performance reasons.<br> | ||
|
||
<a href="https://github.com/TheAlgorithms/Python/blob/master/DIRECTORY.md"><b>List of Algorithms</b></a> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<h1>index</h1> | ||
|
||
<br/> | ||
|
||
<ol> | ||
<li><a href="">Selection Sort</a></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am a bit uncomfortable with an unsorted list of sorting algorithms. Are these sorted alphabetically, sorted for speed, or other? DIRECTORY.md is machine-generated to keep algorithms up-to-date and sorted alphabetically. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a like for like drop-in except for the corrected markdown. The existing pages algorithms were already sorted like this. Ultimately, I was just trying to fix the issue highlighted in #11227 which also has the unsorted list. The wiki can be edited in the GUI by a repo admin in <30seconds |
||
<li><a href="">Bubble Sort</a></li> | ||
<li><a href="">Recursive Bubble Sort</a></li> | ||
<li><a href="">Insertion Sort</a></li> | ||
<li><a href="">Recursive Insertion Sort</a></li> | ||
<li><a href="">Merge Sort</a></li> | ||
<li><a href="">Iterative Merge Sort</a></li> | ||
<li><a href="">Quick Sort</a></li> | ||
<li><a href="">Iterative Quick Sort</a></li> | ||
<li><a href="">Heap Sort</a></li> | ||
<li><a href="">Counting Sort</a></li> | ||
<li><a href="">Radix Sort</a></li> | ||
<li><a href="">Bucket Sort</a></li> | ||
<li><a href="">ShellSort</a></li> | ||
<li><a href="">TimSort</a></li> | ||
<li><a href="">Comb Sort</a></li> | ||
<li><a href="">Pigeonhole Sort</a></li> | ||
<li><a href="">Cycle Sort</a></li> | ||
<li><a href="">Cocktail Sort</a></li> | ||
<li><a href="">Strand Sort</a></li> | ||
<li><a href="">Bitonic Sort</a></li> | ||
<li><a href="">Pancake sorting</a></li> | ||
<li><a href="">Binary Insertion Sort</a></li> | ||
<li><a href="">BogoSort or Permutation Sort</a></li> | ||
<li><a href="">Gnome Sort</a></li> | ||
<li><a href="">Sleep Sort – The King of Laziness / Sorting while Sleeping</a></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I HATE this algorithm because it wastes time and compute power. |
||
<li><a href="">Structure Sorting (By Multiple Rules) </a></li> | ||
<li><a href="">Stooge Sort</a></li> | ||
<li><a href="">Tag Sort (To get both sorted and original)</a></li> | ||
<li><a href="">Tree Sort</a></li> | ||
<li><a href="">Cartesian Tree Sorting</a></li> | ||
<li><a href="">Odd-Even Sort / Brick Sort</a></li> | ||
<li><a href="">QuickSort on Singly Linked List</a></li> | ||
<li><a href="">QuickSort on Doubly Linked List</a></li> | ||
<li><a href="">3-Way QuickSort (Dutch National Flag)</a></li> | ||
<li><a href="">Merge Sort for Linked Lists</a></li> | ||
<li><a href="">Merge Sort for Doubly Linked List</a></li> | ||
<li><a href="">3-way Merge Sort</a></li> | ||
</ol> | ||
|
||
*** | ||
|
||
<h2>Selection sort</h2> | ||
|
||
**Selection sort**, algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from the unsorted part and putting it at the beginning. The algorithm maintains two subarrays in a given array. | ||
<ol> | ||
<li> The subarray which is already sorted.</li> | ||
<li> Remaining subarray which is unsorted.</li> | ||
|
||
In every iteration of selection sort, the minimum element (considering ascending order) from the unsorted subarray is picked and moved to the sorted subarray. | ||
|
||
#### Properties: | ||
- Worst-case performance O(n^2) | ||
- Best-case performance O(n) | ||
- Average case performance O(n^2) | ||
|
||
**read more at: [Wikipedia](https://en.wikipedia.org/wiki/Selection_sort)**<br> | ||
**code: [Selection sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/selection_sort.py)** | ||
|
||
*** | ||
|
||
|
||
<h2>Bubble sort</h2> | ||
|
||
**Bubble sort**, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps them if they are in the wrong order. The pass through the list is repeated until no swaps are needed, which indicates that the list is sorted. The algorithm, which is a comparison sort, is named for the way smaller elements "bubble" to the top of the list. Although the algorithm is simple, it is too slow and impractical for most problems even when compared to insertion sort. It can be practical if the input is usually in sorted order but may occasionally have some out-of-order elements nearly in position. | ||
|
||
#### Properties: | ||
- Worst-case performance O(n^2) | ||
- Best-case performance O(n) | ||
- Average case performance O(n^2) | ||
|
||
**read more at: [Wikipedia](https://en.wikipedia.org/wiki/Bubble_sort)**<br> | ||
**code: [Bubble sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/bubble_sort.py)** | ||
|
||
*** | ||
|
||
|
||
<h2>Insertion sort</h2> | ||
|
||
**Insertion sort** is a simple sorting algorithm that builds the final sorted array (or list) one item at a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort. | ||
|
||
#### Properties: | ||
- Worst-case performance O(n^2) | ||
- Best-case performance O(n) | ||
- Average case performance O(n^2) | ||
|
||
**read more at: [Wikipedia](https://en.wikipedia.org/wiki/Insertion_sort)**<br> | ||
**code: [Insertion sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/insertion_sort.py)** |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<p align="center"><a href="https://github.com/TheAlgorithms/Python/blob/master/CONTRIBUTING.md">Contribution</a> | <a href="https://gitter.im/TheAlgorithms">join at Gitter!</a></p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I suppose that is true. In fixing the wiki issue, the doctests issue was highlighted. Both are addressed here