자료 구조
leetcode p21: merging the two lists
LUCKYIM
2021. 5. 18. 00:17
when you see the leetcode, there is sorted list for l1 and l2.
The main point :
To merge two lists and sort them in increasing order.
pseducode
1. if l1 or l2 are null, return the different list.
2. if not, we have to compare l1 and l2 value
3. arrange it in the increasing order
4. If the one of the list is reached at the end (null), then go to the different list.
dummy node란?
C++
dummy(100) 은 사실 dummy(0)이라고 해도돼고 dummy(INT_MAX) 이라고 도 쓸수있다.
어차피 dummy node는 주소값이 있으니까 값을 굳이 안넣어도 제대로 동작 할것이다. (의미상으로 넣어주는것)