selection algorithm to select nth small elements based on partition - Zero Lee
Zero Lee
·
2012-06-17
·
via 博客园 - Zero Lee
http://en.wikipedia.org/wiki/Selection_algorithm1. partition algorithm 1 function partition(list, left, right, pivotIndex) 2 pivotValue := list[pivotIndex] 3 swap list[pivotIndex] and list[right] // Move pivot to end 4 storeIndex := left 5 for i from left to right-1 6 ...
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。