Multi Link List Implementation
Multi Link List Implementation
BY ROSHAN EDO .A
Multi-Linked Lists in Data Structures
1. MLLs provide flexibility with multiple DLLs have two pointers for moving forward and
connections per node, backward, making traversal easier.
Forward Pointers
Two pointers for different orders.
Backward Pointers
Two pointers for reverse navigation.
Node Deletion
Remove when value becomes zero.
• EXAMPLE :MLL ON STUDENT ORDER OF MARK
• Purpose of Multi-Linked Lists: Used to organize multiple orders of one set of elements.
• Example Use Case: Storing student names and marks in a linked list.
• Order 1: Organize nodes alphabetically by name.
• Order 2: Organize nodes by decreasing marks, with the highest marks appearing first.
Multi-Linked Lists in Sparse Matrices
Space Efficiency 1
Saves memory compared to arrays.
2 Representation
Linked lists for rows and columns.
Node Structure 3
Contains data, pointers, and coordinates.
MLL ON SPARSE MATRIX
Efficiency • MEMORY
• Requires more memory per node.
Efficient for sparse data, saving memory
• COMPLEXITY
compared to arrays.
• Can be harder to manage and debug.
Versatility
Database Indexing
Organizes data by multiple attributes.
Route Planning
Represents graphs with multi-path connections.
Document Editing
Supports multi-directional navigation in grids.
Student Records
Orders records by name or score.
ALGORITHM OF MLL
Here is the multi-level linked list flattening algorithm represented in symbolic form:
function flatten(node):
Description: Let's consider a multi-link list that stores information about students and their courses. Each
student can be enrolled in multiple courses, and each course can have multiple students.
• Student Name
• Pointer to the next student
• Pointer to the STUDENT MARK
TYPES OF MULTI LINKED LIST
1. ARRAY OF LINKED LIST
3. Doubly-Linked Multi-Lists
4. Circular Multi-Lists
7. Skip Lists
1. ARRAY OF LINKED LIST
• Each node in the primary linked list contains a pointer to another linked list.
• Useful when each element of a list can have a sub-list of related items.
3.Doubly-Linked Multi-Lists
• Nodes have multiple pointers, allowing connections both horizontally and vertically.
• Ideal for representing grid structures like spreadsheets or matrices.
• EXAMPLE
4.Circular Multi-Lists
• In a circular multi-list, the final node of each list connects back to the first node, forming a loop.
• This structure is well-suited for repeating sequences or round-robin scheduling.
• EXAMPLE
5.Sparse Matrix Multi-Lists
• Sparse matrices store non-zero elements in linked nodes, allowing for efficient access in both rows and columns.
• This structure saves space by storing only non-zero values and their positions.
• EXAMPLE
6.Graph Representations with Multi-Lists
• Multi-lists can represent graphs where nodes have pointers to multiple other nodes.
• Each node can represent a vertex with pointers to adjacent vertices.
• EXAMPLE
7.Skip Lists
• A skip list has multiple levels of linked lists, optimizing search time.
• Used in data indexing and fast retrieval operations.
• EXAMPLE
Types of Multi-Link Implementations in Trees
Binary Tree with Parent Pointer Multi-Way (n-ary) Tree Binary Tree with Threading (Threaded K-ary Tree with Parent and Sibling
Binary Tree) Pointers
Trie (Prefix Tree) Red-Black Tree with Color Link B-Tree (Balanced Multi-Way Tree) Quad Tree
Binary Tree with Parent Pointer
• Each node has pointers to left, right children, and an additional pointer to its parent.
• Useful in algorithms where navigating back to the parent node is needed, like in certain traversal or
ancestor-finding algorithms.
Multi-Way (n-ary) Tree
• Each node can have n children, where n is greater than two.
• Used in cases like file systems or hierarchical data representations.
Binary Tree with
Threading (Threaded Binary Tree)
• Adds “threads” to a binary tree by linking each node to its in-order predecessor or successor when a left or right child pointer is NULL
• Useful for in-order traversal without needing recursion or a stack.
K-ary Tree with Parent and Sibling Pointers
• Each node has pointers to its parent, first child, and next sibling, enabling efficient navigation within the tree structure.
• Often used in hierarchical models like organization charts.
Trie (Prefix Tree)
• Stores strings, with each node representing a character.
• Uses multiple pointers to represent characters.
• Commonly used in dictionary, autocomplete, and search applications.
Red-Black Tree with Color Link
• A self-balancing binary search tree with a color attribute (red or black) for each node.
• This attribute helps maintain tree balance after insertions or deletions.
B-Tree (Balanced Multi-Way Tree)
• A balanced tree with multiple keys and children, depending on its order.
• Used in databases and file systems for efficient data retrieval.
Quad Tree
• A tree structure with four children, used for spatial partitioning in 2D space.
• Each node divides the space into quadrants, applied in graphics, image processing, and geographical data.
Octree
• Extends a Quad Tree for 3D space, with each node having eight children.
• Used in volumetric data, 3D graphics, and simulation collision detection.
MULTI LINKED LIST USING STACKS
Multiple Stacks: Each node can belong to multiple stacks simultaneously, which is useful for managing shared resources or tasks
across different categories.
EXPLANATION OF CODE
• MultiStackNode: Contains pointers for multiple stacks (e.g., nextStack1, nextStack2).
• Push Functions: Dedicated functions manage data insertion and stack pointers.
• Flexible Linking: Supports multiple stacks and complex relationships through additional pointers.
MLL USES IN [I.T] FIELD
1. Compiler Design:
• Used in parsing expressions and managing scopes.
2. Memory Management:
• Manages function calls and local variables in programming runtimes.
3. Undo Mechanisms:
• Maintains different states for undo/redo operations in applications.
4. Multi-threading:
• Each thread maintains its own stack for function calls and context.
5. Expression Evaluation:
• Manages operators and operands for evaluating arithmetic expressions.
6. Game Development:
• Handles game states and mechanics through separate stacks.
7. Data Structure Libraries:
• Implements specialized stacks for various data types.
8. Network Protocols:
• Manages different layers of network protocols with separate stacks.
9. Event Handling Systems:
• Organizes different types of events through separate stacks.
10. Simulation Systems:
• Tracks states and interactions of entities in simulations.
MULTI LINK LIST ON SORTING WITH
PESUDOCODE .
1. INSERTION SORT BY MLL
2.BUBBLE SORT ON MLL
3.MERGE SORT ON MLL
5.RADIX SORT ON MLL
6.HEAP SORT ON MLL
7.QUICK SORT ON MLL
8.SELECTION SORT ON MLL
THANK YOU !