Analysis of an adaptive algorithm to find the two nearest neighbors |
| |
Authors: | P. V. Poblete |
| |
Affiliation: | (1) Department of Computer Science, University of Chile, Blanco Encalada 2120, Santiago, Chile |
| |
Abstract: | Given a setS ofN distinct elements in random order and a pivotx ∈S, we study the problem of simultaneously finding the left and the right neighbors ofx, i.e.,L=max{u|u<x} andR=min{v|v>x}. We analyze an adaptive algorithm that solves this problem by scanning the setS while maintaining current values for the neighborsL andR. Each new element inspected is compared first against the neighbor in the most populous side, then (if necessary) against the neighbor in the other side, and finally (if necessary), against the pivot. This algorithm may require 3N comparisons in the worst case, but it performs well on the average. If the pivot has rankαN, where α is fixed and <1/2, the algorithm does (1+α)N+Θ(logN) comparisons on the average, with a variance of 3 lnN+Θ(1). However, in the case where the pivot is the median, the average becomes 3/2;N+Θ(√N), while the variance grows to (1/2−π/8)N+Θ(logN). We also prove that, in the αN case, the limit distribution is Gaussian. This work has been supported in part by Grant FONDECYT(Chile) 1950622 and 1981029. Online publication October 6, 2000. |
| |
Keywords: | Analysis of algorithms Selection |
本文献已被 SpringerLink 等数据库收录! |
|