MCPcopy Create free account
hub / github.com/bterwijn/memory_graph / selection_sort

Function selection_sort

src/selection_sort.py:12–22  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

10mg.config.type_to_slicer[float] = (mg.Slicer(), mg.Slicer())
11
12def selection_sort(data):
13 for i in range(len(data) - 1):
14 replace = data[i]
15 min_index = i
16 min_value = replace
17 for j in range(i + 1, len(data)):
18 value = data[j]
19 if value < min_value:
20 min_index = j
21 min_value = value
22 data[i], data[min_index] = min_value, replace
23
24n = 10
25data = [float(i) for i in range(n)]

Callers 1

selection_sort.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected