首页 >  Term: select
select

A four-part algorithm to select the kth smallest element of an array. Part 1) Consider the array as groups of 5 elements; sort and find the median of each group. 2) Use Select recursively to find x, the median of the medians. 3) Next partition the array around x. 4) Let i be the number of elements in the low side of the partition. If k ≤ i, use Select recursively to find the kth element of the low side. Otherwise Select the k-ith element of the high side.

0 0

创建者

  • GeorgeV
  •  (Gold) 1123 分数
  • 100% positive feedback
© 2024 CSOFT International, Ltd.