(a, low, cnt, dire)
| 28 | # sorting its two halves in opposite sorting orders, and then |
| 29 | # calls bitonicMerge to make them in the same order |
| 30 | def bitonicSort(a, low, cnt, dire): |
| 31 | if cnt > 1: |
| 32 | k = int(cnt / 2) |
| 33 | bitonicSort(a, low, k, 1) |
| 34 | bitonicSort(a, low + k, k, 0) |
| 35 | bitonicMerge(a, low, cnt, dire) |
| 36 | |
| 37 | # Caller of bitonicSort for sorting the entire array of length N |
| 38 | |
| 39 | |
| 40 | # in ASCENDING order |