BSEB Inter Computer Science study materials
BSEB Inter Computer Science study resources

BSEB Inter Computer Science: Data Structures

BSEB Inter Computer Science · Work through your exam, one topic at a time.

All guide sections

Data Structures

Data Structures covers arrays, stacks, queues, linked lists, pointers and their operations, along with basic efficiency ideas.

Core rules

An array stores elements of the same type in contiguous memory and supports direct access by index in O(1), but insertion and deletion can cost O(n). A stack is LIFO: push adds at the top, pop removes from the top, and overflow/underflow are boundary errors. A queue is FIFO: insertion at the rear, deletion at the front; a circular queue reuses free space. A linked list stores nodes containing data and a pointer to the next node; it grows dynamically but does not support direct indexing. A singly linked list has one link per node; doubly linked lists have previous and next links. Pointers hold addresses, and NULL marks the end of a list. Common operations are traversal, insertion, deletion and search.

Worked example

Push 10, push 20, pop, push 30, pop. Start empty. Push 10 → [10]. Push 20 → [10,20]. Pop removes 20 → [10]. Push 30 → [10,30]. Pop removes 30 → [10]. The last-in element leaves first, so the sequence is LIFO.

Traps

A queue removes the oldest element, not the newest. Stack top changes on every push/pop; do not update it in the wrong direction. In a linked list, losing the head pointer loses the list. Array index out of bounds is not automatically checked in C. Underflow means deleting from an empty structure.