---
title: "Linked list and its basic operations"
subject: "Data Structure and Algorithm"
chapter: 4
key: "semester_4/data_structure_and_algorithm:linked-list-and-operations"
source: https://www.bctengineer.com/q/semester_4/data_structure_and_algorithm/linked-list-and-operations
site: BCT Engineering
---

# Linked list and its basic operations

Data Structure and Algorithm · Chapter 4: Linked lists

- Asked in: 2069 Bhadra, 3 marks
- Video: [Lec-19: The Basic Operations of Linked List | Data Structure](https://www.youtube.com/watch?v=0XKlbNJLvjs) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_4/data_structure_and_algorithm/linked-list-and-operations
- Whole chapter: https://www.bctengineer.com/md/semester_4/data_structure_and_algorithm/chapter-4

## Question

What are linked lists? What are the basic operations of a linked list?

## Short answer

A linked list is a dynamic linear structure of nodes, each holding data and a pointer to the next node, accessed via a head. Basic operations: creation, traversal, insertion (beginning, end, after a node), deletion, searching, counting, reversing, sorting, and merging. Insert/delete at a known node are O(1) but access to the kth node takes O(k).

## Answer

A **linked list** is a linear dynamic data structure made of nodes. Each node contains a data part (`info`) and a pointer (`next`) to the following node. The list is accessed through an external pointer `start` (head) and the last node's pointer is NULL. Nodes can be anywhere in memory, so the list grows and shrinks at run time.

```text
start -> [10|*]->[20|*]->[30|NULL]
```

#### Basic operations
1. **Creation**: build the list by repeatedly allocating nodes.
2. **Traversal**: visit each node from `start` until NULL (display, count, sum).
3. **Insertion**: at the beginning (`new->next = start; start = new`), at the end, or after/before a given node (change links only).
4. **Deletion**: from the beginning (`start = start->next`), end, or a given node (bypass the node with `prev->next = p->next` and `free(p)`).
5. **Searching**: move node by node comparing `info` with the key; O(n).
6. **Others**: counting nodes, reversing, sorting, merging two lists, copying.

Insertion/deletion at a known position take O(1) with no shifting, but access to the k-th node needs O(k) traversal.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does each node of a linked list contain?
   A. Only data stored contiguously
   B. An index and a value
   C. Two data parts
   D. A data part (info) and a pointer to the next node
   Answer: D. Nodes are linked by pointers, not by position. (Key point: Node content)

2. Which statements insert a new node at the beginning?
   A. new->next = start; start = new
   B. start = new; new->next = start
   C. start->next = new
   D. new->next = NULL; start = NULL
   Answer: A. Link the new node to the old first node before moving start. (Key point: Insert at beginning)

3. Why does access to the k-th node take O(k)?
   A. Nodes are sorted
   B. The nodes must be followed one by one from start
   C. The list must first be copied
   D. A formula gives the address but needs division
   Answer: B. There is no index arithmetic; only the next pointers lead to the node. (Key point: Access cost)

## Related in Data Structure and Algorithm

- [Data structure and basic operations](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Adata-structure-basic-operations) — Data Structure and Algorithm, chapter 1
- [Stack definition and basic operations](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Astack-operations-algorithms) — Data Structure and Algorithm, chapter 2
- [List and its operations](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Alist-and-operations) — Data Structure and Algorithm, chapter 3
- [Linear and circular queue operations](https://www.bctengineer.com/question.md?key=semester_4%2Fdata_structure_and_algorithm%3Alinear-circular-queue-algorithms) — Data Structure and Algorithm, chapter 2

## Related in other subjects

- [Basic lathe operations](https://www.bctengineer.com/question.md?key=semester_2%2Fworkshop_technology%3Alathe-operations-explained) — Workshop Technology, chapter 6
- [Basic forging operations](https://www.bctengineer.com/question.md?key=semester_2%2Fworkshop_technology%3Aforging-operations-explained) — Workshop Technology, chapter 9
- [OLAP operations and star schema in DMQL](https://www.bctengineer.com/question.md?key=semester_7%2Fdata_mining%3Aolap-operations-star-dmql) — Data Mining, chapter 2
- [Control unit sub-operations of GPP](https://www.bctengineer.com/question.md?key=semester_6%2Fembedded_system%3Acontrol-unit-sub-operations) — Embedded System, chapter 2, asked 4×
