JavaScript has no ordered set. Write a class SortedList that keeps its items sorted in an array.
new SortedList(compare), with the same comparator convention as sort; the default is ascending numbersadd(x) inserts an item. Equal items are allowed, so it is a multisetremove(x) removes one item equal to x and returns true, or returns false if there is nonehas(x) returns whether an equal item existsfloor(x) returns the largest item that is <= x, and ceiling(x) the smallest that is >= x, or undefined if there is nonesize is a getter- Find positions with a binary search, not a scan