An algorithm to find convex hull based on binary tree