reimplement ascending and descending by generic algorithm (find)