Given a matrix. Convert it into a linked list matrix such that each node is connected to its next right and down node.
Input : 2D matrix 1 2 3 4 5 6 7 8 9 Output : 1 -> 2 -> 3 -> NULL | | | v v v 4 -> 5 -> 6 -> NULL | | | v v v 7 -> 8 -> 9 -> NULL | | | v v v NULL NULL NULL
Question Source : Factset Interview Experience | Set 9
The idea is to construct a new node for every element of matrix and recursively create its down and right nodes.
1 2 3 4 5 6 7 8 9
This article is contributed by Mandeep Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Construct a linked list from 2D matrix (Iterative Approach)
- Construct a Maximum Sum Linked List out of two Sorted Linked Lists having some Common nodes
- Circular Matrix (Construct a matrix with numbers 1 to m*n in spiral way)
- Create new linked list from two given linked list with greater element at each node
- Construct a unique matrix n x n for an input n
- Construct tree from ancestor matrix
- Difference between Singly linked list and Doubly linked list
- XOR Linked List - A Memory Efficient Doubly Linked List | Set 1
- XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
- Convert singly linked list into circular linked list
- Merge a linked list into another linked list at alternate positions
- Construct Ancestor Matrix from a Given Binary Tree
- Construct a matrix such that union of ith row and ith column contains every element from 1 to 2N-1
- Check if a linked list is Circular Linked List
- Convert Singly Linked List to XOR Linked List