MCPcopy Create free account
hub / github.com/apache/openwhisk-cli / quickSort

Function quickSort

commands/util.go:234–258  ·  view source on GitHub ↗
(toSort Sortables, left int, right int)

Source from the content-addressed store, hash-verified

232}
233
234func quickSort(toSort Sortables, left int, right int) {
235 low := left
236 high := right
237 pivot := toSort[(left+right)/2]
238
239 for low <= high {
240 for toSort[low].Compare(pivot) {
241 low++
242 }
243 for pivot.Compare(toSort[high]) {
244 high--
245 }
246 if low <= high {
247 Swap(toSort, low, high)
248 low++
249 high--
250 }
251 }
252 if left < high {
253 quickSort(toSort, left, high)
254 }
255 if low < right {
256 quickSort(toSort, low, right)
257 }
258}
259
260// makeDefaultHeader(collection) returns the default header to be used in case
261// the list to be printed is empty.

Callers 1

printListFunction · 0.85

Calls 1

SwapFunction · 0.85

Tested by

no test coverage detected