Analyzing time complexity?

O(m) + O(n) = O(m+n), if you know that m>n then O(m+n)=O(m+m)=O(m).

O(m) + O(n) = O(m+n), if you know that m>n then O(m+n)=O(m+m)=O(m). Note: hashes theoretically don't guarantee O(1) lookup, but practically you can count on it (= it's the average complexity, the expected runtime for a random input). Also note, that your algo will repeatedly signal duplicated elements of be which are also present in a.

If this is a problem you have to store in the hash that you already checked/printed out that element.

Average case time complexity is O(m + n). This is what you should consider if you are doing some implementation, since hash maps would usually not have collisions. O(m+n) = O(max(m, n)) However, if this is an test question, by time complexity, people mean worst case time complexity.

Worst case time complexity is O(mn) since each of second steps can take O(n) time in worst case.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions