Write an efficient algorithm to convert multi level linked list into single level. In this problem every node has two pointer next and child pointer. View structure of this linked list.
Given in below examples of view to multi level linked list.
Solve this program using queue.
For example suppose given linked list contain following nodes.
View code animation
Program for convert multi level linked list into single level. Time complexity O(n).
Submit your solution in comment section.