retagged by
923 views

1 Answer

0 votes
0 votes
I am not sure about this.
f(n)=omega(n) which means its best case is n , so lets consider its worst case time complexity as nlogn
g(n)=O(n) which means max it takes n iterations or n units of time to execute
h(n)=theta(n) which means on an average it  takes n units of time to complete

O(f(n)+g(n)) means worst time case to complete f(n)+g(n) is O(n*logn)
omega(f(n)+g(n)) means best case time to complete f(n)+g(n) is omega(n+omega(g(n)),lets assume omega(g(n))=1.so best case is omega(n+1)=omega(n)

now O(f(n)+g(n)-h(n))=O(nlogn-n)=O(n*logn)
omega(f(n)+g(n)-h(n))=omega (n-n) but we cant say that same number of  steps are took in both (f(n)+g(n)) and h(n)
thus omega(f(n)+g(n)-h(n))=omega(n)

Thus its theta(n)
edited by

Related questions

0 votes
0 votes
1 answer
2
0 votes
0 votes
1 answer
3
Vipin Rai asked Jan 4, 2019
534 views
What is the time complexity of the following program?
0 votes
0 votes
0 answers
4