Search algorithms for binary trees and graphs