Why is index = n if element is not found?
Index = n if not found
If the element is not found, the iterator will point to a position just after the last valid index. It just acts as an indicator.
So by checking the iterator, you can know whether the element is present or not.