in Programming in C
267 views
0 votes
0 votes
What is the difference between concatenation of two linked lists and union of two linked lists?
in Programming in C
267 views

1 comment

edited by
In union of two linked list we need to make sure there are no duplicates after the union of two linked lists because sets doesn't have duplicate elements. If one list is of size $n$ and other of size $m$ then time complexity of union of these two list is $O(mn)$

In concat duplicates doesn't matter so we just need to join the 2 list which takes $O min(m,n)$ time
1
1

Please log in or register to answer this question.

Related questions