For 1.I think there is nothing as time complexity of infinite loop, it depends on value of n you have taken.If n is infinitely large number then Time will still be O(n) though computer may crash.

2.T(n)=O(n)+O(n^2)

=O(n^2)

Please correct me if I'm wrong!

2.T(n)=O(n)+O(n^2)

=O(n^2)

Please correct me if I'm wrong!