added find k nearest elements algorithm