MCPcopy Create free account
hub / github.com/ActiveState/code / __sort3

Method __sort3

recipes/Python/577898_23_Tree/recipe-577898.py:124–130  ·  view source on GitHub ↗

Sort 2 or 3 arrays (very rubost and fast)

(self, arr, l)

Source from the content-addressed store, hash-verified

122 self.__insertLink(1, None)
123
124 def __sort3(self, arr, l):
125 """ Sort 2 or 3 arrays (very rubost and fast) """
126 if l >= 2:
127 if arr[0] > arr[1]: arr[0], arr[1] = arr[1], arr[0]
128 if l == 3:
129 if arr[1] > arr[2]: arr[1], arr[2] = arr[2], arr[1]
130 if arr[0] > arr[1]: arr[0], arr[1] = arr[1], arr[0]
131
132
133 # interface methods & properties

Callers 1

insertValueMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected