/** * If a vertex named name exists in the the array vertices between positions begin and end (inclusive), then * returns the position where this vertex is, i.e., i such that vertices[i].word.compareTo(name) == 0 * * If such a vertex does not exist, returns -(1 + the first position in the array that is greater than name), * i.e., i such that vertices[-(i+1)].word.compareTo(name)>0, but vertices[-(i+2)].word.compareTo(name) < 0, * or, in other words -(1+insertion point of name). * * For example, if vertices contains {"b", "d", "f"}, begin is 0, and end is 2 then it will return: * 0 on input "b" * 1 on input "d" * 2 on input "f" * -1 on input "a" (because the first position in the array that is greater than "a" is 0) * -2 on input "c" * -3 on input "e" * -4 on input "g" and above * * In particular, the vertex has been found if and only if the return value is >=0, and * the vertices in locations Math.abs(return_value + 1) and above are exactly the vertices that are greater than name, * regardless of whether the vertex has been found * * This behaviour is the same as Java's Arrays.binarySearch method * * If end=0 and =0 and