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,902 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - i - 1)
i = i + 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
9550e418-a019-49c2-a2e9-8322a300fb6f
| 2,016 |
22,933 |
def circumference(r):
return 2 * pi * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| false |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
34,788 |
def area(r):
return pi * r * r
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| false |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
40,714 |
def selection_sort(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 += 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
daaef1e8-1fe4-4dc4-b002-6e89fad22a66
| 2,016 |
813 |
def selection_sort(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 += 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
daaef1e8-1fe4-4dc4-b002-6e89fad22a66
| 2,016 |
12,257 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def selection_sort(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
swap(a, i, p)
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
9675c8b9-337a-4fd1-bb8f-8e3510c7f703
| 2,016 |
39,988 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def selection_sort(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
swap(a, i, p)
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
9675c8b9-337a-4fd1-bb8f-8e3510c7f703
| 2,016 |
37,969 |
def area(n):
p * n ** 2
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| false |
17658437-97b1-4a8a-ac6f-a63a54536e33
| 2,016 |
29,218 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
712c50ed-0c17-44f1-a863-183f2d9a5e14
| 2,016 |
33,971 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
712c50ed-0c17-44f1-a863-183f2d9a5e14
| 2,016 |
31,089 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
427cdab9-477f-4fb3-92b0-bf5eef785c90
| 2,016 |
7,877 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
427cdab9-477f-4fb3-92b0-bf5eef785c90
| 2,016 |
23,743 |
def selection_sort(a):
i = 0
j = 1
while i < len(a):
j = i
while j < len(a):
if a[j] < a[i]:
tmp = a[j]
a[j] = a[i]
a[i] = tmp
j = j + 1
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
3d19e1db-d496-420c-b077-41631364e4f7
| 2,016 |
2,485 |
def selection_sort(a):
i = 0
j = 1
while i < len(a):
j = i
while j < len(a):
if a[j] < a[i]:
tmp = a[j]
a[j] = a[i]
a[i] = tmp
j = j + 1
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
3d19e1db-d496-420c-b077-41631364e4f7
| 2,016 |
19,633 |
def selection_sort(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
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
e5db5e57-0261-4967-963a-42d1a98c03de
| 2,016 |
27,178 |
def selection_sort(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
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
e5db5e57-0261-4967-963a-42d1a98c03de
| 2,016 |
10,096 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - i - 1)
i = i + 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
4e44ac28-c84a-43ee-9b95-c4270d7bb030
| 2,016 |
31,303 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - 1 - i)
i += 1
return a
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
7a72123c-6850-4e9f-b407-211283f04a4c
| 2,016 |
14,277 |
def selection_sort(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 += 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
652b3384-e559-46c5-81db-1bf2117db63b
| 2,016 |
34,201 |
def selection_sort(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 += 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
652b3384-e559-46c5-81db-1bf2117db63b
| 2,016 |
21,013 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
fa7e9f17-de07-4868-ab69-667438d7becd
| 2,016 |
17,974 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
fa7e9f17-de07-4868-ab69-667438d7becd
| 2,016 |
11,762 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def find_smallest_position(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest_position(a, i)
swap(a, i, p)
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
9550e418-a019-49c2-a2e9-8322a300fb6f
| 2,016 |
28,885 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def find_smallest_position(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest_position(a, i)
swap(a, i, p)
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
9550e418-a019-49c2-a2e9-8322a300fb6f
| 2,016 |
9,239 |
def swap(a, i, j):
tmp = a[i]
a[i] = a[j]
a[j] = tmp
def selection_sort(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
swap(a, i, p)
i = i + 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
88e97329-9c3f-4e1a-8643-1311f4e801a9
| 2,016 |
8,952 |
def swap(a, i, j):
tmp = a[i]
a[i] = a[j]
a[j] = tmp
def selection_sort(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
swap(a, i, p)
i = i + 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
88e97329-9c3f-4e1a-8643-1311f4e801a9
| 2,016 |
4,956 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - 1 - i)
i += 1
return a
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
f463a026-5eb4-4a39-a858-3a798215a4ee
| 2,016 |
32,473 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def find_smallest_position(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest_position(a, i)
swap(a, i, p)
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
32a14d12-9054-46cd-aa7e-4bf97d33fa10
| 2,016 |
11,275 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def find_smallest_position(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest_position(a, i)
swap(a, i, p)
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
32a14d12-9054-46cd-aa7e-4bf97d33fa10
| 2,016 |
17,995 |
def selection_sort(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
print(tmp)
i += 1
return tmp
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
f463a026-5eb4-4a39-a858-3a798215a4ee
| 2,016 |
9,816 |
def selection_sort(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
print(tmp)
i += 1
return tmp
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
f463a026-5eb4-4a39-a858-3a798215a4ee
| 2,016 |
40,071 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
return a
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - 1 - i)
i = i + 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
5a6b9af4-c978-4326-ba5b-405c4a284f15
| 2,016 |
9,021 |
def selection_sort(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[i]
a[i] = a[p]
a[p] = tmp
i = i + 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
6f8302a0-5974-4b36-a8e9-6b3968a8fce1
| 2,016 |
1,071 |
def selection_sort(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[i]
a[i] = a[p]
a[p] = tmp
i = i + 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
6f8302a0-5974-4b36-a8e9-6b3968a8fce1
| 2,016 |
22,997 |
def selection_sort(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 += 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
61b5b70e-4e9d-424d-ba4b-cab01b8c205f
| 2,016 |
8,356 |
def selection_sort(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 += 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
61b5b70e-4e9d-424d-ba4b-cab01b8c205f
| 2,016 |
3,084 |
def swap(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
def find_smallest_value(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest_value(a, i)
swap(a, i, p)
i += 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
41c113b8-6f57-4003-bed3-3587b2376170
| 2,016 |
6,676 |
def swap(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
def find_smallest_value(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest_value(a, i)
swap(a, i, p)
i += 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
41c113b8-6f57-4003-bed3-3587b2376170
| 2,016 |
34,650 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
4e44ac28-c84a-43ee-9b95-c4270d7bb030
| 2,016 |
41,835 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
4e44ac28-c84a-43ee-9b95-c4270d7bb030
| 2,016 |
35,761 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
8d8fa15f-3f0d-4a69-849b-9b7da96123cd
| 2,016 |
1,352 |
def swap(a, i, j):
tmp = a[i]
a[i] = a[j]
a[j] = tmp
def selection_sort(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
swap(a, i, p)
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
| 2,016 |
14,386 |
def swap(a, i, j):
tmp = a[i]
a[i] = a[j]
a[j] = tmp
def selection_sort(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
swap(a, i, p)
i = i + 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
4b622395-1c2b-4a5d-ba03-c6e0e0ef2dd7
| 2,016 |
31,404 |
def swap(a, i, j):
tmp = a[i]
a[i] = a[j]
a[j] = tmp
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - 1 - i)
i = i + 1
return a
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
621f49f9-6d90-49c2-ada6-2cb48080552a
| 2,016 |
14,408 |
def double(n):
return n * 2
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
29883390-7aa0-4484-9f1e-6fd0c1c8c420
| 2,016 |
19,862 |
def area(r):
return 3.141 * r ** 2
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| true |
29883390-7aa0-4484-9f1e-6fd0c1c8c420
| 2,016 |
39,399 |
def circumference(r):
return 2 * 3.141 * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| true |
29883390-7aa0-4484-9f1e-6fd0c1c8c420
| 2,016 |
11,958 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def reverse(a):
i = 0
j = len(a) - 1
while i <= j:
swap(a, i, j)
i += 1
j = j - 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
2f34a0ed-0d6a-447e-8e47-6a90f11d53a7
| 2,016 |
27,266 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
5a6b9af4-c978-4326-ba5b-405c4a284f15
| 2,016 |
38,052 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
5a6b9af4-c978-4326-ba5b-405c4a284f15
| 2,016 |
41,579 |
def selection_sort(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
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
621f49f9-6d90-49c2-ada6-2cb48080552a
| 2,016 |
33,145 |
def selection_sort(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
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
621f49f9-6d90-49c2-ada6-2cb48080552a
| 2,016 |
26,708 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, i, len(a) - i - 1)
i += 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
15,753 |
def smallest(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
return p
def swap(a, i, p):
tmp = a[p]
a[p] = a[i]
a[i] = tmp
def selection_sort(a):
i = 0
while i < len(a):
p = smallest(a, i)
swap(a, i, p)
i += 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
17,067 |
def smallest(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
return p
def swap(a, i, p):
tmp = a[p]
a[p] = a[i]
a[i] = tmp
def selection_sort(a):
i = 0
while i < len(a):
p = smallest(a, i)
swap(a, i, p)
i += 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
98d44d17-92f8-4274-915e-b88bdd9dca26
| 2,016 |
27,343 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def find_smallest_position(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest_position(a, i)
swap(a, i, p)
i = i + 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
2f34a0ed-0d6a-447e-8e47-6a90f11d53a7
| 2,016 |
23,043 |
def swap(a, i, j):
tmp = a[j]
a[j] = a[i]
a[i] = tmp
def find_smallest_position(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j = j + 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest_position(a, i)
swap(a, i, p)
i = i + 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
2f34a0ed-0d6a-447e-8e47-6a90f11d53a7
| 2,016 |
32,944 |
def double(n):
return n * 2
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
9a05c20e-2fde-40c1-948b-649e25b30e6e
| 2,016 |
8,559 |
def area(r):
return pi * r ** 2
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| false |
9a05c20e-2fde-40c1-948b-649e25b30e6e
| 2,016 |
11,757 |
def circumference(r):
return 2 * pi * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| false |
9a05c20e-2fde-40c1-948b-649e25b30e6e
| 2,016 |
25,363 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
6ae36e81-5a79-4a87-a484-a86635591a14
| 2,016 |
1,204 |
def double(n):
y = n * 2
return y
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
2157ade0-6890-435b-8669-a884e3233bc7
| 2,016 |
2,850 |
def double(n):
y = n * 2
return y
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
2157ade0-6890-435b-8669-a884e3233bc7
| 2,016 |
19,092 |
def area(r):
return pi * r ** 2
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| false |
2157ade0-6890-435b-8669-a884e3233bc7
| 2,016 |
521 |
def circumference(r):
return 2 * pi * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| false |
2157ade0-6890-435b-8669-a884e3233bc7
| 2,016 |
25,952 |
def swap(a, i, j):
tmp = a[i]
a[i] = a[j]
a[j] = tmp
return a
def reverse(a):
i = 0
while i < len(a) / 2:
swap(a, len(a) - 1 - i, i)
i = i + 1
return a
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| true |
9a05c20e-2fde-40c1-948b-649e25b30e6e
| 2,016 |
30,550 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
9a05c20e-2fde-40c1-948b-649e25b30e6e
| 2,016 |
33,556 |
def selection_sort(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
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
9a05c20e-2fde-40c1-948b-649e25b30e6e
| 2,016 |
7,564 |
def swap(a, i, p):
tmp = a[i]
a[i] = a[p]
a[p] = tmp
def findsmallest(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = findsmallest(a, i)
swap(a, i, p)
i += 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
431d0ef6-9edd-464b-a5fa-cccf8b152f4e
| 2,016 |
751 |
def swap(a, i, p):
tmp = a[i]
a[i] = a[p]
a[p] = tmp
def findsmallest(a, i):
p = i
j = i + 1
while j < len(a):
if a[j] < a[p]:
p = j
j += 1
return p
def selection_sort(a):
i = 0
while i < len(a):
p = findsmallest(a, i)
swap(a, i, p)
i += 1
return a
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| true |
431d0ef6-9edd-464b-a5fa-cccf8b152f4e
| 2,016 |
38,448 |
def double(n):
return n * 2
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
32,464 |
def double(n):
return n * 2
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
6,783 |
def circumference(r):
return 2 * 3.141 * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| true |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
22,824 |
def area(r):
return 3.141 * r ** 2
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| true |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
17,976 |
def area(r):
return 3.141 * r ** 2
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| true |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
17,119 |
def circumference(r):
return 2 * 3.141 * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| true |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
15 |
def circumference(r):
return 2 * 3.141 * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| true |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
2,104 |
def area(r):
return 3.141 * r ** 2
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| true |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
11,945 |
def swap(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
def reverse(a):
i = 0
j = len(a) - 1
while i != j:
swap(a, i, j)
i += 1
j -= 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
31,694 |
def swap(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
def reverse(a):
i = 0
j = len(a) - 1
while i < len(a) / 2 - 1:
swap(a, i, j)
i += 1
j -= 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
40,445 |
def swap(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
def reverse(a):
i = 0
j = len(a) - 1
while i < len(a) / 2:
swap(a, i, j)
i += 1
j -= 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
28,558 |
def swap(a, i, j):
temp = a[i]
a[i] = a[j]
a[j] = temp
def reverse(a):
i = 0
j = len(a) - 1
while i < len(a) / 2:
swap(a, i, j)
i += 1
j -= 1
|
reverse_by_swap
|
reverse
|
Reverse a list of elements by swapping its elements.
|
assert reverse([])==[] and reverse([0])==[0] and reverse([-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052])==[1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103] and reverse([-103, 113466788817036974729578468346735566318, 31758, 1867157052, 10933, -70, 1867157052])==[1867157052, -70, 10933, 1867157052, 31758, 113466788817036974729578468346735566318, -103] and reverse([1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103])==[-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052] and reverse([1867157052, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, -103])==[-103, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, 1867157052] and reverse([-103, 113466788817036974729578468346735566318, 31758, -70, 10933, 1867157052, 1867157052])==[1867157052, 1867157052, 10933, -70, 31758, 113466788817036974729578468346735566318, -103] and reverse([[1]])==[[1]]
| false |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
37,973 |
def selection_sort(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
temp = a[i]
a[i] = a[p]
a[p] = temp
i += 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
6,912 |
def selection_sort(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
temp = a[i]
a[i] = a[p]
a[p] = temp
i += 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
15c8870d-4f5a-4578-b0fb-4dd4a4402626
| 2,016 |
25,932 |
def reverse(list):
reversed = []
i = len(list) - 1
while i >= 0:
reversed.append(list[i])
i = i - 1
return reversed
|
reverse_iter
|
reverse
|
Iteratively reverse a list of elements.
|
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
| true |
77d2e8c4-7a6c-4b2b-a2c4-40bb9700563f
| 2,016 |
30,026 |
def reverse(list):
reversed = []
i = len(list) - 1
while i >= 0:
reversed.append(list[i])
i = i - 1
return reversed
|
reverse_iter
|
reverse
|
Iteratively reverse a list of elements.
|
assert reverse([])==[] and reverse([20, 10, 0, -10, -20])==[-20, -10, 0, 10, 20] and reverse(['toto', True, [10, 0, 9], 12.8, 6])==[6, 12.8, [10, 0, 9], True, 'toto']
| true |
77d2e8c4-7a6c-4b2b-a2c4-40bb9700563f
| 2,016 |
5,132 |
def find_smallest(a, i):
p = i
q = i + 1
while q < len(a):
if a[q] < a[p]:
p = q
q += 1
return p
def swap(a, i, p):
tmp = a[p]
a[p] = a[i]
a[i] = tmp
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest(a, i)
swap(a, i, p)
i += 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
431d0ef6-9edd-464b-a5fa-cccf8b152f4e
| 2,016 |
21,648 |
def find_smallest(a, i):
p = i
q = i + 1
while q < len(a):
if a[q] < a[p]:
p = q
q += 1
return p
def swap(a, i, p):
tmp = a[p]
a[p] = a[i]
a[i] = tmp
def selection_sort(a):
i = 0
while i < len(a):
p = find_smallest(a, i)
swap(a, i, p)
i += 1
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
431d0ef6-9edd-464b-a5fa-cccf8b152f4e
| 2,016 |
39,812 |
def bsearch(a, q):
low = 0
high = len(a)
while low < high:
mid = (low + high) / 2
if a[mid] < q:
low = mid + 1
else:
high = mid
return low
|
bsearch
|
bsearch
|
Search for element q in the sorted array a.
|
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
| false |
b46a0d8e-c049-41aa-b896-956cda3c8d13
| 2,016 |
41,838 |
def bsearch(a, q):
low = 0
high = len(a)
while low < high:
mid = (low + high) / 2
if a[mid] < q:
low = mid + 1
else:
high = mid
return low
|
bsearch
|
bsearch
|
Search for element q in the sorted array a.
|
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
| false |
b46a0d8e-c049-41aa-b896-956cda3c8d13
| 2,016 |
28,102 |
def selection_sort(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
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
b46a0d8e-c049-41aa-b896-956cda3c8d13
| 2,016 |
1,293 |
def selection_sort(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
|
selection_sort
|
selection_sort
|
Sort a list by repeatedly move minimimum of remaining sublist to front.
|
assert selection_sort([])==[] and selection_sort([0])==[0] and selection_sort([25204, -1, -18176])==[-18176, -1, 25204] and selection_sort([-18176, -1, 25204])==[-18176, -1, 25204]
| false |
b46a0d8e-c049-41aa-b896-956cda3c8d13
| 2,016 |
16,832 |
def double(x):
y = x * 2
return y
|
double
|
double
|
Double a number or a string.
|
assert double(0)==0 and double(-7601)==-15202
| true |
f6343d5f-9ee0-441c-a67c-781ee180947e
| 2,016 |
17,906 |
def circumference(r):
y = 2 * pi * r
|
circumference
|
circumference
|
Return the circumference of a circle.
|
assert circumference(0)==0.0 and circumference(-23091)==-145057.662
| false |
f6343d5f-9ee0-441c-a67c-781ee180947e
| 2,016 |
16,658 |
def area(r):
y = pi * r ** 2
|
area
|
area
|
Return the area of a circle with the given coordinates.
|
assert area(0)==0.0 and area(-14329)==644910876.981
| false |
f6343d5f-9ee0-441c-a67c-781ee180947e
| 2,016 |
9,853 |
def bsearch(a, q):
low = 0
high = len(a)
while low < high:
mid = low + (high - low) / 2
if a[mid] < q:
low = mid + 1
else:
high = mid
return low
|
bsearch
|
bsearch
|
Search for element q in the sorted array a.
|
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
| false |
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
| 2,016 |
4,984 |
def bsearch(a, q):
low = 0
high = len(a)
while low < high:
mid = low + (high - low) / 2
if a[mid] < q:
low = mid + 1
else:
high = mid
return low
|
bsearch
|
bsearch
|
Search for element q in the sorted array a.
|
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
| false |
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
| 2,016 |
17,235 |
def bsearch(a, q):
low = 0
high = len(a)
while low < high:
mid = low + (high - low) / 2
if a[mid] < q:
low = mid + 1
else:
high = mid
return low
|
bsearch
|
bsearch
|
Search for element q in the sorted array a.
|
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
| false |
df8dd1dd-a7c8-46c0-b89f-ec170a81f08a
| 2,016 |
27,764 |
def bsearch(a, q):
high = len(a)
low = 0
while low < high:
mid = (low + high) / 2
if a[mid] < q:
low = mid + 1
assert low == 0 or a[low - 1] < q
else:
high = mid
assert q <= a[high]
return low
|
bsearch
|
bsearch
|
Search for element q in the sorted array a.
|
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
| false |
431d0ef6-9edd-464b-a5fa-cccf8b152f4e
| 2,016 |
4,944 |
def bsearch(a, q):
high = len(a)
low = 0
while low < high:
mid = (low + high) / 2
if a[mid] < q:
low = mid + 1
assert low == 0 or a[low - 1] < q
else:
high = mid
assert q <= a[high]
return low
|
bsearch
|
bsearch
|
Search for element q in the sorted array a.
|
assert bsearch([],12)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],5)==4 and bsearch([1, 2, 3, 4, 6, 7, 8],1)==0 and bsearch([1, 2, 3, 4, 6, 7, 8],4)==3
| false |
431d0ef6-9edd-464b-a5fa-cccf8b152f4e
| 2,016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.