modified to sorted set
add sort and search code in chapter5