Skip to content
Advertisement

Tag: time-complexity

Can we say O(n + m) is equivalent to O(n), when m is constant or when n > m

I was solving one of the leetcode problems(Longest Palindrome), where I am traversing the whole string(s) to count the frequency of each character traversing the array(charFreq) to determine whether the frequency of character is odd and doing operations accordingly. 1. Implementing using array where, 1 <= s.length <= 2000 s consists of lowercase and/or uppercase English letters only. But, is

Analysis of run time complexity

I need some help below I have some code I created for an assignment. I am having a hard time figuring out the time complexity of this algorithm. I looked at it and believe the O-notation is 0(n) and …

Advertisement