We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf82459 commit 28ac3fdCopy full SHA for 28ac3fd
SleepSort.py
@@ -1,19 +1,23 @@
1
-from time import sleep
2
from threading import Timer
+from time import sleep
3
+
4
5
def sleep_sort(l):
6
res = []
7
8
def add1(x):
9
res.append(x)
10
11
mx = l[0]
12
for i in l:
13
if mx < i:
14
mx = i
15
Timer(i, add1, [i]).start()
- sleep(mx+1)
16
+ sleep(mx + 1)
17
return res
18
-l1 = [4,1,2,8,5]
19
20
+l1 = [4, 1, 2, 8, 5]
21
print("Initial Array")
22
print(l1)
23
0 commit comments