Linked List and Memory Management
Official syllabus text (word for word)
Linked List and Memory Management — Singly Linked List - Operations on Linked List, Stacks and Queues using Linked List, Polynomial representation using Linked List; Doubly Linked List; Circular Linked List; Memory allocation - First-fit, Best-fit, and Worst-fit allocation schemes; Garbage collection and compaction.
- 1Singly linked lists and their operations
Nodes that point to the next node: create, traverse, count, find the largest, insert, delete, search and append.
lesson livevisualizerC codeasked 9× - 2Stacks and queues using linked lists
A stack and a queue that never overflow (until memory runs out) — built from linked nodes.
lesson livevisualizerC code - 3Polynomials using linked lists
Each term becomes a node (coef, expon, link); add two polynomials by walking both lists together.
lesson livevisualizerC codeasked 2× - 4Doubly linked lists
Two links per node — walk forward AND backward; insert or delete without hunting for the previous node.
lesson livevisualizerC codeasked 3× - 5Circular linked lists
The last node points back to the first: no NULL at the end, and O(1) insertion at both ends with a single last pointer.
lesson livevisualizerC codeasked 1× - 6Memory allocation: first-fit, best-fit, worst-fit
Where does malloc find space? First-fit, best-fit and worst-fit, fragmentation, and both KTU allocation questions solved.
lesson livevisualizerC codeasked 2× - 7Garbage collection and compaction
Finding memory nobody can reach any more (mark & sweep), and squeezing the holes together (compaction).
lesson livevisualizerC code