The nearly optimal n-ary search tree