MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / bitonicMerge

Function bitonicMerge

sorts/BitonicSort.py:17–25  ·  view source on GitHub ↗
(a, low, cnt, dire)

Source from the content-addressed store, hash-verified

15# The sequence to be sorted starts at index position low,
16# the parameter cnt is the number of elements to be sorted.
17def bitonicMerge(a, low, cnt, dire):
18 if cnt > 1:
19 k = int(cnt / 2)
20 for i in range(low, low + k):
21 compAndSwap(a, i, i + k, dire)
22 bitonicMerge(a, low, k, dire)
23 bitonicMerge(a, low + k, k, dire)
24
25 # This funcion first produces a bitonic sequence by recursively
26
27
28# sorting its two halves in opposite sorting orders, and then

Callers 1

bitonicSortFunction · 0.85

Calls 1

compAndSwapFunction · 0.85

Tested by

no test coverage detected