The binary search always returns the first element that is equal to the one we are looking for, but as we could do to return the positions of all the elements that are equal to the one we are looking for, for example, we have a vector of:
H-H-J-O
If I use a binary search, looking for H, will it tell me that the H is in position 0, ignoring the second one in position 1, is there any way to adapt the search to return the position of all the elements? In this case the output would be, the H is in position 0 and in position 1 thanks in advance