Why to use binary search?

If it is a sorted array then why can’t we simply be running a forward loop for the lower bound and where ever we encounter the data 1st that can be declared the lower bound and for the upper bound we can run the loop in the reverse order

Hey @mishikasrvastava
Binary Search is more efficient then linear traversal
for example :
1 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 5 6 7 8 9 9 9 9 9 9 11
find upper and lower bound of 11
in Case lower bound its linear traversal ( Not efficient)