submission_id
int32 10
42.5k
| func_code
stringlengths 22
782
| assignment_id
stringlengths 4
23
| func_name
stringlengths 4
23
| description
stringlengths 26
128
| test
stringlengths 45
1.22k
| correct
bool 2
classes | user
stringlengths 36
36
| academic_year
int32 2.02k
2.02k
|
---|---|---|---|---|---|---|---|---|
32,880 | def maximum(n):
if len(n) == 1:
return n[0]
if n[0] > n[1]:
n.remove(n[1])
else:
n.remove(n[0])
return maximum(n) | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
28,826 | def count_letters(s):
if len(s) == 0:
return 0
s = list(s)
s.remove(s[0])
return 1 + count_letters(s) | count_letters | count_letters | Return the number of lettres in a string. | assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13 | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
30,570 | def count_letters(s):
if len(s) == 0:
return 0
s = list(s)
s.remove(s[0])
return 1 + count_letters(s) | count_letters | count_letters | Return the number of lettres in a string. | assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13 | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
41,232 | def reverse_list(l):
if len(l) == 0:
return []
a = l[-1]
a.pop()
return [a] + reverse_list(l) | reverse_recur | reverse_list | Recursively reverse a list of elements. | assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85] | false | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
24,150 | def reverse_list(l):
if len(l) == 0:
return []
a = l[-1]
l.pop()
return [a] + reverse_list(l) | reverse_recur | reverse_list | Recursively reverse a list of elements. | assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85] | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
14,485 | def reverse_list(l):
if len(l) == 0:
return []
a = l[-1]
l.pop()
return [a] + reverse_list(l) | reverse_recur | reverse_list | Recursively reverse a list of elements. | assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85] | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
26,535 | def fibonacci(n):
if n == 0:
return 1
if n == 1:
return 1
return fibonacci(n - 1) + fibonacci(n - 2) | fibonacci_recur | fibonacci | Recursively compute the value of the fibonacci series at position n. | assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657 | false | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
19,261 | def fibonacci(n):
if n == 0:
return 1
if n == 1:
return 1
return fibonacci(n - 1) + fibonacci(n - 2) | fibonacci_recur | fibonacci | Recursively compute the value of the fibonacci series at position n. | assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657 | false | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
14,458 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
32,143 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
14,852 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
29,352 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
30,810 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 7b8e2d7b-1f3a-4e34-b02c-e6ac46baa465 | 2,016 |
39,628 | def power(m, n):
if n == 0:
return 1
return m * power(m, n - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
33,392 | def power(m, n):
if n == 0:
return 1
return m * power(m, n - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
6,624 | def minimum(n):
if len(n) == 1:
return n[0]
if n[0] < n[1]:
n.remove(n[1])
return minimum(n)
else:
n.remove(n[0])
return minimum(n) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
35,416 | def minimum(n):
if len(n) == 1:
return n[0]
if n[0] < n[1]:
n.remove(n[1])
return minimum(n)
else:
n.remove(n[0])
return minimum(n) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
19,796 | def maximum(n):
if len(n) == 1:
return n[0]
if n[0] > n[1]:
n.remove(n[1])
return maximum(n)
else:
n.remove(n[0])
return maximum(n) | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
615 | def maximum(n):
if len(n) == 1:
return n[0]
if n[0] > n[1]:
n.remove(n[1])
return maximum(n)
else:
n.remove(n[0])
return maximum(n) | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | f1c26f39-fb4c-4010-aaa3-142fb52f57b9 | 2,016 |
20,287 | def power(n, p):
if p == 0:
return 1
else:
return power(n, p - 1) * n | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
39,189 | def power(n, p):
if p == 0:
return 1
else:
return power(n, p - 1) * n | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
23,080 | def minimum(l):
if len(l) == 1:
return l[0]
else:
min_ret = minimum(l[1:])
return l[0] if l[0] < min_ret else min_ret | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
17,138 | def minimum(l):
if len(l) == 1:
return l[0]
else:
min_ret = minimum(l[1:])
return l[0] if l[0] < min_ret else min_ret | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
29,689 | def maximum(l):
if len(l) == 1:
return l[0]
else:
max_ret = maximum(l[1:])
return l[0] if l[0] > max_ret else max_ret | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
9,535 | def maximum(l):
if len(l) == 1:
return l[0]
else:
max_ret = maximum(l[1:])
return l[0] if l[0] > max_ret else max_ret | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
9,125 | def count_letters(s):
if s == '':
return 0
else:
return 1 + count_letters(s[1:]) | count_letters | count_letters | Return the number of lettres in a string. | assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13 | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
20,018 | def count_letters(s):
if s == '':
return 0
else:
return 1 + count_letters(s[1:]) | count_letters | count_letters | Return the number of lettres in a string. | assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13 | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
20,499 | def fibonacci(h):
if h == 0 or h == 1:
return 1
return fibonacci(h - 1) + fibonacci(h - 2) | fibonacci_recur | fibonacci | Recursively compute the value of the fibonacci series at position n. | assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657 | false | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
19,074 | def fibonacci(h):
if h == 0 or h == 1:
return 1
return fibonacci(h - 1) + fibonacci(h - 2) | fibonacci_recur | fibonacci | Recursively compute the value of the fibonacci series at position n. | assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657 | false | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
31,184 | def reverse_list(l):
if len(l) == 0:
return []
else:
return [l[-1]] + reverse_list(l[:-1]) | reverse_recur | reverse_list | Recursively reverse a list of elements. | assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85] | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
18,737 | def reverse_list(l):
if len(l) == 0:
return []
else:
return [l[-1]] + reverse_list(l[:-1]) | reverse_recur | reverse_list | Recursively reverse a list of elements. | assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85] | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
38,963 | def fibonacci(n):
if n == 0 or n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2) | fibonacci_recur | fibonacci | Recursively compute the value of the fibonacci series at position n. | assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657 | false | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
8,634 | def fibonacci(n):
if n == 0 or n == 1:
return 1
else:
return fibonacci(n - 1) + fibonacci(n - 2) | fibonacci_recur | fibonacci | Recursively compute the value of the fibonacci series at position n. | assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657 | false | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
552 | def quicksort(A, start, end):
if end - start < 1:
return
i = j = start
while i <= end:
if A[i] <= A[end]:
A[i], A[j] = A[j], A[i]
j += 1
i += 1
quicksort(A, start, j - 2)
quicksort(A, j, end) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
40,399 | def quicksort(A, start, end):
if end - start < 1:
return
i = j = start
while i <= end:
if A[i] <= A[end]:
A[i], A[j] = A[j], A[i]
j += 1
i += 1
quicksort(A, start, j - 2)
quicksort(A, j, end) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
41,743 | def selectionsort(A):
for i in range(len(A)):
min_j = i
for j in range(i, len(A)):
if A[j] < A[min_j]:
min_j = j
A[i], A[min_j] = A[min_j], A[i] | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
5,523 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
32,180 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
35,391 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 4e44ac28-c84a-43ee-9b95-c4270d7bb030 | 2,016 |
32,267 | def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | false | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
27,279 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
33,727 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
998 | def selectionsort(A, p, r):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | false | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
6,232 | def selectionsort(A):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | false | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
8,228 | def selectionsort(A):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | false | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
403 | def selectionsort(A):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
a[i], a[p] = a[p], a[i]
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | false | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
28,180 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
a[i], a[p] = a[p], a[i]
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
42,181 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
a[i], a[p] = a[p], a[i]
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
28,201 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
a[i], a[p] = a[p], a[i]
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | 4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7 | 2,016 |
11,538 | def power(a, b):
if b == 0:
return 1
else:
return power(a, b - 1) * a | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | daaef1e8-1fe4-4dc4-b002-6e89fad22a66 | 2,016 |
15,952 | def power(a, b):
if b == 0:
return 1
else:
return power(a, b - 1) * a | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | daaef1e8-1fe4-4dc4-b002-6e89fad22a66 | 2,016 |
31,291 | def minimum(l):
if len(l) == 1:
return l[0]
else:
min_ret = minimum(l[1:])
return l[0] if l[0] < min_ret else min_ret | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | daaef1e8-1fe4-4dc4-b002-6e89fad22a66 | 2,016 |
41,586 | def minimum(l):
if len(l) == 1:
return l[0]
else:
min_ret = minimum(l[1:])
return l[0] if l[0] < min_ret else min_ret | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | daaef1e8-1fe4-4dc4-b002-6e89fad22a66 | 2,016 |
14,685 | def maximum(l):
if len(l) == 1:
return l[0]
else:
max_ret = maximum(l[1:])
return l[0] if l[0] > max_ret else max_ret | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | daaef1e8-1fe4-4dc4-b002-6e89fad22a66 | 2,016 |
2,862 | def maximum(l):
if len(l) == 1:
return l[0]
else:
max_ret = maximum(l[1:])
return l[0] if l[0] > max_ret else max_ret | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | daaef1e8-1fe4-4dc4-b002-6e89fad22a66 | 2,016 |
28,166 | def power(m, n):
if n == 0:
return 1
return m * power(n - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
33,318 | def power(m, n):
if n == 0:
return 1
return m * power(m, n - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
29,371 | def power(m, n):
if n == 0:
return 1
return m * power(m, n - 1) | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
24,883 | def minimum(l):
if l == []:
return []
temp = minimum(l[1:])
if len(temp) == 0 or l[0] > temp[0]:
temp = [l[0]]
return temp[0] | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
33,669 | def minimum(l):
if l == []:
return []
temp = minimum(l[1:])
if len(temp) == 0 or l[0] > temp[0]:
temp = [l[0]]
return temp[0] | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
25,173 | def minimum(l):
if l == []:
return []
temp = minimum(l[1:])
print(temp)
if len(temp) == 0 or l[0] > temp[0]:
temp = [l[0]]
return temp[0] | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
2,277 | def minimum(l):
if l == []:
return []
temp = minimum(l[1:])
if l[0] > temp[0]:
temp = [l[0]]
return temp[0] | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
26,741 | def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def minimum(l):
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
return quicksort(l, 0, len(l) - 1)[0] | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
30,047 | def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def minimum(l):
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
quicksort(l, 0, len(l) - 1)
return l[0] | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
39,622 | def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def minimum(l):
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
quicksort(l, 0, len(l) - 1)
return l[0] | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
5,635 | def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def maximum(l):
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
quicksort(l, 0, len(l) - 1)
return l[-1] | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
12,768 | def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def maximum(l):
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r)
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
quicksort(l, 0, len(l) - 1)
return l[-1] | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
1,651 | def selectionsort(a):
j = 0
i = 1
while i < len(a):
if a[i] < a[j]:
j = i
i += 1
return a | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
14,784 | def count_letters(s):
if s == '':
return 0
s = s[1:]
return 1 + count_letters(s) | count_letters | count_letters | Return the number of lettres in a string. | assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13 | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
12,729 | def count_letters(s):
if s == '':
return 0
s = s[1:]
return 1 + count_letters(s) | count_letters | count_letters | Return the number of lettres in a string. | assert count_letters('')==0 and count_letters('0')==1 and count_letters('##')==2 and count_letters('t')==1 and count_letters('fqfseqfseqsse')==13 | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
38,342 | def selectionsort(a):
i = 0
while i < len(a):
p, j = i, i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
a[p], a[i] = a[i], a[p]
i += 1
return a | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
7,463 | def selectionsort(a):
i = 0
while i < len(a):
p, j = i, i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
a[p], a[i] = a[i], a[p]
i += 1
return a | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
29,108 | def partition(A, p, r):
q = j = p
while j > r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
def partition(A, p, r):
q = j = p
while j > r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 05f63619-1095-4d15-8436-1f0832a593bc | 2,016 |
27,705 | def reverse_list(l):
if l == []:
return []
temp = reverse(l[1:])
temp.append(l[0])
return temp | reverse_recur | reverse_list | Recursively reverse a list of elements. | assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85] | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
29,945 | def reverse_list(l):
if l == []:
return []
temp = reverse_list(l[1:])
temp.append(l[0])
return temp | reverse_recur | reverse_list | Recursively reverse a list of elements. | assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85] | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
20,942 | def reverse_list(l):
if l == []:
return []
temp = reverse_list(l[1:])
temp.append(l[0])
return temp | reverse_recur | reverse_list | Recursively reverse a list of elements. | assert reverse_list([])==[] and reverse_list([0])==[0] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457, 85, -74, -10050, 787, -3])==[-3, 787, -10050, -74, 85, -109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650] and reverse_list([0, 0])==[0, 0] and reverse_list([85, -74, -10050, 787, 9650, 12103, -1947378123, -109345868112896702250879906349988323457, -3])==[-3, -109345868112896702250879906349988323457, -1947378123, 12103, 9650, 787, -10050, -74, 85] and reverse_list([85, -74, -10050, 787, -3, 9650, 12103, -1947378123, -109345868112896702250879906349988323457])==[-109345868112896702250879906349988323457, -1947378123, 12103, 9650, -3, 787, -10050, -74, 85] | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
19,597 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 05f63619-1095-4d15-8436-1f0832a593bc | 2,016 |
25,552 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | 05f63619-1095-4d15-8436-1f0832a593bc | 2,016 |
17,288 | def minimum(a, minimum=None):
if not a:
return minimum
test = a.pop()
if test < minimum or minimum == None:
return minimum(a, test)
else:
return minimum(a, minimum) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
22,217 | def fibonacci(n):
if n == 0:
return 1
if n == 1:
return 1
return fibonacci(n - 1) + fibonacci(n - 2) | fibonacci_recur | fibonacci | Recursively compute the value of the fibonacci series at position n. | assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657 | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
24,455 | def fibonacci(n):
if n == 0:
return 1
if n == 1:
return 1
return fibonacci(n - 1) + fibonacci(n - 2) | fibonacci_recur | fibonacci | Recursively compute the value of the fibonacci series at position n. | assert fibonacci(0)==0 and fibonacci(1)==1 and fibonacci(2)==1 and fibonacci(10)==55 and fibonacci(23)==28657 | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
38,170 | def minimum(a, minimum=0):
if not a:
return minimum
test = a.pop()
if test < minimum or minimum == 0:
return minimum(a, test)
else:
return minimum(a, minimum) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
40,388 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
4,657 | def partition(A, p, r):
q = j = p
while j < r:
if A[j] <= A[r]:
A[q], A[j] = A[j], A[q]
q += 1
j += 1
A[q], A[r] = A[r], A[q]
return q
def quicksort(A, p, r):
if r <= p:
return
q = partition(A, p, r)
quicksort(A, p, q - 1)
quicksort(A, q + 1, r) | quicksort | quicksort | Sort a list by recursively partitionioning list until sorted. | assert quicksort([],0,0)==None and quicksort([],0,0)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 4, 3, 2, 1],0,4)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5, 5, 5, 5],0,3)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None and quicksort([5675, 564, 987, 154132, 8976, 0, -16221, 87526, 9826732986],0,8)==None | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
31,861 | def minimum(a, minimum=0):
if not a:
return minimum
test = a.pop()
if test < minimum or minimum == 0:
return minimum(a, test)
return minimum(a, minimum) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
22,001 | def power(m, n):
if n == 0:
return 1
else:
return m ** n | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | f6343d5f-9ee0-441c-a67c-781ee180947e | 2,016 |
16,350 | def power(m, n):
if n == 0:
return 1
else:
return m ** n | power | power | Raise m to the power of n. | assert power(0,0)==1 and power(62,4)==14776336 and power(-14012,0)==1 | true | f6343d5f-9ee0-441c-a67c-781ee180947e | 2,016 |
644 | def minimum(a, minimum=0):
if not a:
return minimum
test = int(a.pop())
if test < minimum or minimum == 0:
return minimum(a, test)
return minimum(a, minimum) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
35,362 | def minimum(a, minimum=0):
if not a:
return minimum
test = str(a.pop())
if int(test) < int(minimum) or int(minimum) == 0:
return minimum(a, int(test))
return minimum(a, int(minimum)) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
16,831 | def minimum(a, minimum=0):
if not a:
return minimum
test = str(a.pop())
if int(test) < int(minimum) or int(minimum) == 0:
return minimum(a, test)
return minimum(a, minimum) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | false | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
23,693 | def selectionsort(l):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1
return l | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | false | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
20,432 | def minimum(a, mini=0):
if not a:
return mini
test = a.pop()
if test < mini or mini == 0:
return minimum(a, test)
return minimum(a, mini) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
2,483 | def minimum(a, mini=0):
if not a:
return mini
test = a.pop()
if test < mini or mini == 0:
return minimum(a, test)
return minimum(a, mini) | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
9,058 | def maximum(a, high=0):
if not a:
return high
test = a.pop()
if test > high or high == 0:
return maximum(a, test)
return maximum(a, high) | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
26,982 | def maximum(a, high=0):
if not a:
return high
test = a.pop()
if test > high or high == 0:
return maximum(a, test)
return maximum(a, high) | maximum | maximum | Return the maximum element in a list of numbers. | assert maximum([0])==0 and maximum([67, 1, 2, -2, 0])==67 and maximum([0, -2, 2, 1, 67])==67 and maximum([-10, -23, -45, -9, -45617])==-9 | true | 59b507a0-b0a2-42b7-a6af-736ab71c8fe1 | 2,016 |
18,154 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
9,701 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
13,122 | def selectionsort(a):
i = 0
while i < len(a):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
tmp = a[p]
a[p] = a[i]
a[i] = tmp
i = i + 1 | selectionsort | selectionsort | Sort a list by repeatedly move minimimum of remaining sublist to front. | assert selectionsort([])==None and selectionsort([])==None and selectionsort([0])==None and selectionsort([0])==None | true | c0a5d565-4fbf-4274-85af-71162f38b8d4 | 2,016 |
15,513 | def minimum(n):
if len(n) == 1:
return n[0]
else:
minimum_ret = minimum(n[1:])
return n[0] if n[0] < minimum_ret else minimum_ret | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | f6343d5f-9ee0-441c-a67c-781ee180947e | 2,016 |
29,384 | def minimum(n):
if len(n) == 1:
return n[0]
else:
minimum_ret = minimum(n[1:])
return n[0] if n[0] < minimum_ret else minimum_ret | minimum | minimum | Return the minimum element in a list of numbers. | assert minimum([0])==0 and minimum([2, 10, 23, 9, 187])==2 and minimum([-2, -26, 7, -123, -1236521])==-1236521 and minimum([3896, 3673, 45, 16715, 23673])==45 | true | f6343d5f-9ee0-441c-a67c-781ee180947e | 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.