What is the average time complexity of bruth-force method?

  • 1

    if i use the bruth-force method, not the KMP algorithm, the best time is O(m), the worst time is O(mn). (m is length of longer string, n is the length of another string). What's the average time complexity and why?

  • 0

    Why would you care about average time complexity? The time complexity measure assumes worst case and it's O(N^2) in brute force case.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.