0 0 votes complexity of algorithm to interchange the nth and mth element (node) of singly link list is: a.m+n b.m if m>=n otherwise n c.m if m<=n otherwise n d.m+min(m,n) ans given c???????????how Programming in C data-structures + – akankshadewangan24 1.3k views answer comment Share Follow Print See all 6 Comments 6 6 Comments reply joshi_nitish commented Dec 2, 2017 reply Follow flag answer should be b), it will take O(max(m,n)) 0 0 replyShare akankshadewangan24 commented Dec 2, 2017 reply Follow flag How???? 0 0 replyShare joshi_nitish commented Dec 2, 2017 reply Follow flag to swap node m and n, firstly we have to travel farthest of m and n, which will take O(max(m,n)) , and then swapping can be done in O(1) time. so overall, it will take -> O(max(m,n)) + O(1) = O(max(m,n)) 2 2 replyShare Ashwin Kulkarni commented Dec 2, 2017 reply Follow flag Yes exactly answer should be B. 0 0 replyShare Anu007 commented Dec 2, 2017 reply Follow flag if you put O(max(m,n)) then a will also be correct right? let N= n3 and M= n2 Then O(M+N) also saying same b/c of big oh. 0 0 replyShare joshi_nitish commented Dec 2, 2017 reply Follow flag yes, A) is also right, but B) is more appropriate. 1 1 replyShare Please log in or register to add a comment.