1

For a size n sorted array of strings, binary search would take O(log n) in terms of n. However, what would be the run time in terms of the length of strings?

1 Answer 1

1

The complexity of string comparison is linear time with respect to the string length, so, in this case, letting m = string length, the complexity would be

O(m lg n).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.