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.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Construct a Doubly linked linked list from 2D Matrix
- Construct a Maximum Sum Linked List out of two Sorted Linked Lists having some Common nodes
- Construct a linked list from 2D matrix (Iterative Approach)
- Construct Linked List from 3D Matrix
- Circular Matrix (Construct a matrix with numbers 1 to m*n in spiral way)
- Construct a square Matrix whose parity of diagonal sum is same as size of matrix
- XOR Linked List - A Memory Efficient Doubly Linked List | Set 1
- XOR Linked List – A Memory Efficient Doubly Linked List | Set 2
- Merge a linked list into another linked list at alternate positions
- Check if a linked list is Circular Linked List
- Convert singly linked list into circular linked list
- Difference between Singly linked list and Doubly linked list
- Convert Singly Linked List to XOR Linked List
- Create new linked list from two given linked list with greater element at each node
- Construct Ancestor Matrix from a Given Binary Tree
- Construct tree from ancestor matrix
- Construct a unique matrix n x n for an input n
- Construct a matrix such that union of ith row and ith column contains every element from 1 to 2N-1
- Construct a Matrix of size NxN with values in range [1, N^2] as per given conditions
- Construct a matrix with sum equal to the sum of diagonal elements