Unit summary
- A linked list is a chain of nodes, each holding data and a pointer to the next node, with dynamic size but no direct access.
- Singly linked lists support traversal, search, insertion and deletion by changing pointers.
- Doubly linked lists add prev pointers, and circular lists link the last node back to the first.
- Polynomials are stored as lists of (coefficient, exponent) terms and added like merging sorted lists.
- Hashing maps keys to table slots with a hash function, giving O(1) average operations.
- Collisions are resolved by open addressing (linear, quadratic, double hashing) or by chaining.
Glossary
| Term | Meaning |
|---|---|
| Chaining | Keeping a list of items in each slot. |
| Circular linked list | A list whose last node points to the first. |
| Collision | Two keys mapped to one slot. |
| Doubly linked list | A list with prev and next pointers. |
| Hash function | A function giving the slot for a key. |
| Hash table | A table indexed by hash values. |
| Hashing | Mapping keys to table positions. |
| HEAD | The pointer to the first node. |
| Linear probing | Trying the next slots in turn. |
| Linked list | A chain of nodes joined by pointers. |
| Load factor | The ratio of items to slots. |
| malloc | A C function that allocates memory at run time. |
| Node | A unit holding data and a link. |
| NULL | The marker for the end of a list. |
| Polynomial node | A node holding a coefficient and an exponent. |
| Traversal | Visiting every node once. |
| Underflow | Deleting from an empty structure. |
Question bank
Short Answer Questions (2 marks each)
- Define a linked list.
- Compare arrays and linked lists.
- What is a doubly linked list?
- What is a circular linked list?
- How is a node inserted at the beginning of a list?
- How is a polynomial represented by a linked list?
- Define hashing.
- What is the division method of hashing?
- What is a collision?
- Distinguish open addressing and chaining.
Medium Answer Questions (5 marks each)
- Explain the representation of a linked list in memory.
- Write an algorithm to insert a node at a given position in a singly linked list.
- Write an algorithm to delete a node with a given value.
- Explain insertion and deletion in a doubly linked list.
- Write an algorithm to add two polynomials using linked lists.
- Explain the types of hash functions.
Long Answer Questions (15 marks each)
- Explain linked lists, their types and their comparison with arrays, with diagrams.
- Explain traversal, insertion, deletion and searching in a singly linked list.
- Explain doubly and circular linked lists, and the addition of polynomials.
- Explain hashing, hash functions, collisions and their resolution by open addressing and chaining.
Sources
- Official BCA syllabus Data Structures, course code 25BCA402DS02, Unit II
