Given a order list. Which supports only following operations.
insert(n)
Insert an element in tail only if n is greater than value of current tail otherwise throw exception
empty(n)
Check if list is empty
remove()
remove an element from tail and return value
Given a order list as input. We need to write a function copyList(source,destination)
, which copies one order list to another order list.
- We are not allowed to use any additional data structure.
- We can use at max one more temp order list.
I tried solving this problem but not getting any solution.