File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Python/Algorithms/SortingAlgorithms Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ This slowSort is inplace sorting algorithm for an list of integer
3+ The idea behind it is,
4+ it divides an input list into two half, call itself into two half. and then compairs the maximum element
5+ of the two half. It store the maximum element of the subarray at the top of the position
6+ of the sub array . then it recursively call the subarray without the maximum elements.
7+
8+ """
9+
10+
11+
12+ def slowSort (arr , left , right ):
13+
14+ if left >= right :
15+ return
16+
17+ mid = (left + right )// 2
18+
19+ slowSort (arr , left , mid )
20+ slowSort (arr , mid + 1 , right )
21+
22+ if arr [mid ] > arr [right ]:
23+ arr [mid ], arr [right ] = arr [right ], arr [mid ]
24+
25+ slowSort (arr , left , right - 1 )
26+
You can’t perform that action at this time.
0 commit comments