diff --git a/Python.wiki/Home.md b/Python.wiki/Home.md new file mode 100644 index 000000000000..765420b7b2ae --- /dev/null +++ b/Python.wiki/Home.md @@ -0,0 +1,6 @@ +## Python Algorithms +- All the algorithms are implemented in **Python** for **education purpose** only.
+- These are just for **demonstration** purpose.
+- There are many implementations of different algorithms in the Python standard library that are much better for performance reasons.
+ +List of Algorithms diff --git a/Python.wiki/Sorting-Algorithms.md b/Python.wiki/Sorting-Algorithms.md new file mode 100644 index 000000000000..709cea5d4204 --- /dev/null +++ b/Python.wiki/Sorting-Algorithms.md @@ -0,0 +1,93 @@ +

index

+ +
+ +
    +
  1. Selection Sort
  2. +
  3. Bubble Sort
  4. +
  5. Recursive Bubble Sort
  6. +
  7. Insertion Sort
  8. +
  9. Recursive Insertion Sort
  10. +
  11. Merge Sort
  12. +
  13. Iterative Merge Sort
  14. +
  15. Quick Sort
  16. +
  17. Iterative Quick Sort
  18. +
  19. Heap Sort
  20. +
  21. Counting Sort
  22. +
  23. Radix Sort
  24. +
  25. Bucket Sort
  26. +
  27. ShellSort
  28. +
  29. TimSort
  30. +
  31. Comb Sort
  32. +
  33. Pigeonhole Sort
  34. +
  35. Cycle Sort
  36. +
  37. Cocktail Sort
  38. +
  39. Strand Sort
  40. +
  41. Bitonic Sort
  42. +
  43. Pancake sorting
  44. +
  45. Binary Insertion Sort
  46. +
  47. BogoSort or Permutation Sort
  48. +
  49. Gnome Sort
  50. +
  51. Sleep Sort – The King of Laziness / Sorting while Sleeping
  52. +
  53. Structure Sorting (By Multiple Rules)
  54. +
  55. Stooge Sort
  56. +
  57. Tag Sort (To get both sorted and original)
  58. +
  59. Tree Sort
  60. +
  61. Cartesian Tree Sorting
  62. +
  63. Odd-Even Sort / Brick Sort
  64. +
  65. QuickSort on Singly Linked List
  66. +
  67. QuickSort on Doubly Linked List
  68. +
  69. 3-Way QuickSort (Dutch National Flag)
  70. +
  71. Merge Sort for Linked Lists
  72. +
  73. Merge Sort for Doubly Linked List
  74. +
  75. 3-way Merge Sort
  76. +
+ +*** + +

Selection sort

+ +**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. +
    +
  1. The subarray which is already sorted.
  2. +
  3. Remaining subarray which is unsorted.
  4. + +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)**
    +**code: [Selection sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/selection_sort.py)** + +*** + + +

    Bubble sort

    + +**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)**
    +**code: [Bubble sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/bubble_sort.py)** + +*** + + +

    Insertion sort

    + +**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)**
    +**code: [Insertion sort](https://github.com/TheAlgorithms/Python/blob/master/sorts/insertion_sort.py)** diff --git a/Python.wiki/_Footer.md b/Python.wiki/_Footer.md new file mode 100644 index 000000000000..b304535c2357 --- /dev/null +++ b/Python.wiki/_Footer.md @@ -0,0 +1 @@ +

    Contribution | join at Gitter!

    \ No newline at end of file