BSCS students can download the complete Aikman Series textbook “Data Structures in C++” as a free PDF. Written by C M Aslam (M.Sc. Computer Science, M.Sc. Punjab University) and published by Aikman Book Corporation, Lahore, this book covers all the fundamental data structures taught in Pakistani universities using the C++ programming language.
The book runs 241 pages across 9 chapters, from basic terminology to graphs. Every topic is explained in three steps — first the concept, then a numbered algorithm, then a working C++ program — and each chapter closes with fill-in-the-blanks, true/false and programming exercises. That structure makes it easy to use for self-study as well as sessional and final exam preparation.
Book Overview
| Course | Data Structures & Algorithms |
| Level | University / BSCS |
| Series | Aikman Series |
| Author | C M Aslam (M.Sc. Comp. Sc., M.Sc. PU) |
| Publisher | Aikman Book Corporation, Urdu Bazar, Lahore |
| Language | English |
| Total Chapters | 9 |
| Total Pages | 241 |
| Format | PDF (Free Download) |
Chapter List
Chapter 1: Introduction
Difficulty: Easy · Key topics: data vs information, field–record–file, linear & non-linear structures, algorithmic notation
The opening chapter builds the vocabulary used in the rest of the book. It separates data (raw facts) from information (processed, meaningful data), then works down the hierarchy of entity, field, record, file and primary key. From there it defines a data structure as basic data types combined into a new user-defined type, splits structures into linear and non-linear forms, and lists the operations performed on them. The second half introduces the book’s algorithmic notation — numbered steps, assignment, input/output, selection, Repeat For and Repeat While loops — and sub-algorithms, each followed by a matching C++ program.
Key Points:
- Data is raw facts; processed data that carries useful meaning is information.
- Hierarchy: field → record → file. A primary key is the field whose value uniquely identifies a record.
- Linear structures store elements in a sequence (arrays, stacks, queues, linked lists); non-linear ones do not (trees, graphs).
- Core operations: inserting, deleting, searching, traversing, sorting, merging — plus creation and destruction.
- An algorithm is a named, numbered step-by-step procedure; the book writes it in notation first, then in C++.
- Sub-algorithms come in two forms: functions (return a value) and procedures (perform a task).
Memory Tip: Picture a school register to keep the hierarchy straight — one column is a field (the student’s name), one full row is a record (one student), and the whole register is a file (the class). The primary key is the column that never repeats: the roll number.
Common Mistake: The chapter prints the labels “primitive / non-primitive” and “linear / non-linear” together. Keep them apart in the exam: primitive refers to int, char and float, while linear and non-linear describe how the elements are arranged.
Important Questions:
- What is the difference between data and information? Data is the raw facts collected for a purpose; information is that data after processing, when it carries a useful meaning.
- Which data structures are linear and which are non-linear? Arrays, linked lists, stacks and queues are linear because their elements sit in a sequence; trees and graphs are non-linear because their elements are not arranged in sequence.
Chapter 2: Arrays
Difficulty: Easy · Key topics: index, lower and upper bound, base address, two-dimensional arrays
Arrays are presented here as the simplest data structure: an ordered collection of elements of one type, each reached through the array name and its index. The chapter fixes the vocabulary — index, size, lower bound, upper bound — and shows how the number of elements is calculated, noting that C++ starts counting at 0. It then explains how an array occupies one continuous block of memory, how the address of any element is worked out from the base address, and how insertion and deletion shift the remaining elements. The last part moves to two-dimensional arrays: rows and columns, row-major and column-major storage, and the rules for adding and multiplying matrices.
Key Points:
- Every element of an array is of the same type and is reached by the array name plus an index.
- Number of elements = UB − LB + 1. In C++ the first index is 0, so a 10-element array runs from 0 to 9.
- Static declaration fixes the size at declaration time; dynamic declaration lets the size change during execution.
- An array occupies one continuous memory block, and the address of its first element is the base address.
- Address of the kth element = L₀ + C × (k − 1), where C is the size of one element in bytes.
- Deleting from a middle position moves every later element one place towards the start and reduces the size.
- A two-dimensional array (table or matrix) with m rows and n columns holds m × n elements, stored in row-major or column-major order.
Memory Tip: For row-major and column-major, the word in the name is the part that stays together in memory: row-major stores the whole first row, then the whole second row; column-major stores the whole first column, then the second.
Common Mistake: Counting elements as UB − LB. The formula adds 1 because both ends are included — an array indexed 0 to 9 holds ten elements, not nine.
Important Questions:
- What are the lower bound and upper bound of an array? The lower bound is the index of the first element and the upper bound the index of the last; the array holds UB − LB + 1 elements.
- What is the difference between row-major and column-major order? Row-major stores a two-dimensional array one complete row after another, while column-major stores it one complete column after another.
Chapter 3: Strings
Difficulty: Easy · Key topics: null character, fixed and variable-length strings, string descriptor, sub-string operations
A string is defined as a sequence of symbols — letters, digits or special characters — and its length is the count of those symbols. The chapter explains the null character that marks the end of a string in C++, then covers the three ways a string is held in memory: fixed-length strings, whose size is set at declaration; variable-length strings, stored either with a boundary marker or with a string descriptor; and linked strings, which spread the text across nodes joined by links. The rest of the chapter works through the standard string operations — length, copying, concatenation, sub-string extraction, pattern matching, insertion, deletion and replacement — each with an algorithm and a C++ program.
Key Points:
- A string is an array of characters; each character takes one byte and the end is marked by the null character ‘\0’.
- A string with no symbols has zero length and is called an empty or null string.
- Fixed-length strings reserve their memory at declaration, so whatever is unused is wasted.
- Variable-length strings are separated in memory by a boundary marker, or described by a string descriptor with a length field and a pointer field.
- In linked strings each node holds a fixed number of characters plus a link to the node carrying the next part.
- String operations normally act on a group of consecutive characters — a sub-string — not on a single element the way array operations do.
Memory Tip: The three storage types line up with three trade-offs — fixed-length wastes space, variable-length saves space but needs a marker or a descriptor, and linked storage handles growth but spends memory on links.
Common Mistake: Counting the null character in the string length. The length of “Pak” is three, even though it takes four bytes in memory once ‘\0’ is added.
Important Questions:
- What is the difference between a fixed-length and a variable-length string? A fixed-length string keeps the size given at declaration for the whole program, while a variable-length string is declared without a size and can change during execution.
- How is a string stored using a string descriptor? Through two fields — a length field holding the number of characters and a pointer field holding the address of the first character.
Chapter 4: Stacks
Difficulty: Medium · Key topics: LIFO, push/pop, overflow & underflow, recursion, postfix notation
A stack is defined here as a linear list where insertion and deletion happen only at the top, so items come out in Last In First Out order — the book uses a spring-loaded dish rack as its example. The chapter shows a stack stored as a linear array with Top and Bottom positions, then gives the Push and Pop procedures along with the overflow and underflow conditions. The second half is the heavier part: recursion (direct and indirect, depth of recursion, base criteria) and why a stack is the natural structure to implement it, followed by expression evaluation, Polish and Reverse Polish notation, and infix-to-postfix conversion using a stack.
Key Points:
- A stack allows only two operations, and both act on the top: pushing (insert) and popping (delete).
- Pushing into a full stack causes overflow; popping from an empty stack causes underflow.
- Top is the most accessible item, Bottom the least; a stack is normally represented as a linear array.
- A recursive procedure must have a base criteria, and every call must move closer to it — otherwise it never stops.
- Recursion is implemented with a stack: the prologue saves parameters and the return address, the epilogue restores them.
- Polish (prefix) puts the operator before its operands (+XY), Reverse Polish (postfix) after them (XY+); postfix needs no parentheses.
Practice Tip: Infix-to-postfix conversion never sticks by reading alone. Take the book’s own example, X+6*(Y+Z)^3, and work through it on paper, writing the state of the stack after every operator. Two or three expressions in, the rule becomes obvious — and this is the conversion that turns up in the paper.
Common Mistake: Swapping overflow and underflow. Pushing into a full stack is overflow; popping from an empty one is underflow — the chapter’s true/false questions state these the wrong way round on purpose.
Important Questions:
- What is a stack and why is it called a LIFO structure? It is a linear list where items can be inserted and removed only from the top, so the item pushed last is always the first one popped.
- Why is a stack used to implement recursion? Each call must save its parameters and return address and get them back in reverse order of calling — that last-in, first-out behaviour is exactly what a stack provides.
Chapter 5: Queues
Difficulty: Medium · Key topics: FIFO, front and rear, deque, priority queue
A queue is introduced as a linear structure where items are inserted at the rear and removed from the front, giving First In First Out order — the book compares it to a line of people waiting to be served. It explains why queues exist as buffers, with process management and print spooling as examples, then shows the array representation with pointer variables F and R and the QINSERT and QDEL procedures. The chapter then covers two variations: the deque, where insertion and deletion are allowed at both ends (with input-restricted and output-restricted forms), and the priority queue, where each item carries a priority that decides the order of service.
Key Points:
- Items enter a queue at the rear and leave from the front, so a queue works First In First Out.
- A queue is normally stored as a linear array with two pointers — F for the front and R for the rear.
- Inserting an item increases R by 1; deleting an item increases F by 1.
- A deque (double-ended queue) allows insertion and deletion at both ends, but never in the middle.
- An input-restricted deque permits insertion at one end only; an output-restricted deque permits deletion at one end only.
- In a priority queue the higher-priority item is served first, and items sharing a priority are served in the order they arrived.
Memory Tip: Keep the two structures apart with their everyday pictures: a queue is a line at a counter, so whoever came first is served first, while a stack is a pile of plates, so the plate put down last is picked up first. Front and rear exist only in the queue — a stack has one open end.
Common Mistake: Swapping front and rear. Insertion is always at the rear and deletion always at the front; the chapter’s true/false questions state these the wrong way round on purpose.
Important Questions:
- What is the difference between a queue and a deque? A queue allows insertion only at the rear and deletion only at the front, while a deque allows both operations at either end — though never in the middle.
- How does a priority queue differ from an ordinary queue? An ordinary queue removes items in the order they arrived; a priority queue removes the higher-priority item first and uses arrival order only between items of equal priority.
Chapter 6: Searching & Sorting
Difficulty: Medium · Key topics: sequential search, binary search, bubble, selection, insertion and merge sort
This chapter covers the two operations performed most often on arrays. Searching is presented in two forms: sequential search, which checks elements one by one and suits small, unordered lists, and binary search, which starts from the middle of a sorted list and throws away half the data at each step. Sorting is then introduced through the key field and key value of a record, followed by four methods — bubble, selection, insertion and merge sort — each with a worked array example, a numbered algorithm and a C++ program. The chapter closes with exercises that ask you to compare these methods directly.
Key Points:
- Sequential search scans from the first element to the last; simple, but slow and only suitable for small lists.
- Binary search checks the middle element and discards half the list each time — but the list must already be sorted.
- Bubble sort compares neighbouring items and swaps them; it is the simplest and the slowest, needing n-1 iterations.
- Selection sort picks the smallest remaining value and swaps it into the next position; usable up to about 1000 items.
- Insertion sort shifts elements to the right instead of swapping, and is roughly twice as efficient as bubble sort.
- Merge sort splits the array at MID = (LB + UB) / 2, sorts both halves recursively and merges them — but needs an extra array.
Memory Tip: Hold the four sorting methods with one verb each — Bubble: swap (with the neighbour), Selection: choose (the smallest), Insertion: shift (to make room), Merge: split (then join). The “differentiate between” question at the end of the chapter rests on exactly these four verbs.
Common Mistake: Running a binary search on an unsorted list. The definition itself requires the list to be in ascending or descending order first, otherwise comparing against the middle value means nothing.
Important Questions:
- What is the difference between sequential and binary search? Sequential search checks every element in order and works on any list; binary search jumps to the middle of a sorted list and halves the remaining data at each step, so it is far faster on large lists.
- Which sorting method does not swap elements, and how does it work? Insertion sort — instead of swapping, it shifts the larger elements one position to the right to make room, then inserts the element in its correct place.
Chapter 7: Linked Lists
Difficulty: Hard · Key topics: pointers, nodes, single and double linked lists, circular lists
The chapter opens with the limits of arrays — they need one adjacent block of memory, their size is fixed, and access slows as they grow — and presents linked lists as the answer. Data is held in nodes that may sit anywhere in memory, each carrying a pointer to the next node, so the list is joined logically rather than physically. After explaining pointers, it covers the single linked list with its Start pointer and NULL-terminated link field, the C++ structure used to define a node and the new operator that creates one, then insertion, deletion and traversal. The last sections add circular linked lists, where the final node points back to the first, and double linked lists, whose nodes also store the address of the previous node.
Key Points:
- A linked list keeps its data in nodes that may sit anywhere in memory, joined by pointers instead of by adjacency.
- Each node of a single linked list has at least two fields: a data field and a link field holding the address of the next node.
- The link field of the last node holds NULL, and a list with no node at all is itself NULL.
- The Start pointer holds the address of the first node — it is the only way into the list.
- In C++ nodes are created during execution with the
newoperator and removed withdelete. - In a circular linked list the last node points back to the first; in a double linked list every node also stores the address of the previous node, so it can be travelled in both directions.
Memory Tip: Count the link fields to name the list — one link is a single (one-way) list, two links is a double (two-way) list, and one link that leads back to the start is a circular list.
Common Mistake: Assuming the nodes of a linked list sit in consecutive memory locations. They do not, and that is exactly why linked lists are used when no large adjacent block is free.
Important Questions:
- What is the difference between a single and a double linked list? A single linked list stores only the address of the next node, so it can be travelled in one direction; a double linked list also stores the address of the previous node and can be travelled both ways.
- Why are linked lists used instead of arrays? An array needs one continuous block of memory and a size fixed in advance, while a linked list places its nodes anywhere in memory and can grow or shrink while the program runs.
Chapter 8: Trees
Difficulty: Hard · Key topics: root and leaf, depth and height, binary search tree, preorder / inorder / postorder
This is the longest chapter in the book. It begins with tree terminology — root, parent, child, siblings, subtree, leaf, degree, depth and height — using a family tree and an organisation chart as examples, then narrows from general trees to binary trees, where a node has at most two children. Full, extended (2-tree) and complete binary trees are each defined and drawn. The binary search tree follows, with its ordering rule and the fact that an inorder traversal prints its values in ascending order. Two storage techniques are compared, linked and sequential, before the chapter works through insertion, searching, deletion and the three traversal orders, each with a stack-based algorithm and a C++ program.
Key Points:
- A tree is a non-linear structure with one root, and every other node has exactly one parent.
- The depth of the root is 0, the height of a tree is the greatest depth in it, and an empty tree has height −1.
- A binary tree allows at most two children per node; in an extended (2-)tree every node has either no child or two.
- In a binary search tree the left child is smaller than its root and the right child greater or equal, and no two nodes share a key value.
- Traversing a binary search tree inorder prints its values in ascending order.
- In sequential (array) storage the left child of node K goes to position 2K and the right child to 2K + 1.
- Preorder = root, left, right · Inorder = left, root, right · Postorder = left, right, root — all three are implemented with a stack.
Memory Tip: The traversal names say where the root goes — preorder takes the root first, inorder takes it in the middle, postorder takes it last. Left always comes before right in all three, so only the root moves.
Common Mistake: Choosing the array (sequential) representation for a tree that is not full. Space still has to be reserved for the missing nodes, so a tree of depth 5 holding only 11 nodes needs an array of about 64 elements.
Important Questions:
- What is a binary search tree? A binary tree in which every left child holds a value smaller than its root and every right child a greater or equal value, with no two nodes sharing a key.
- What is the difference between preorder, inorder and postorder traversal? Preorder visits root, left, right; inorder visits left, root, right, which prints a binary search tree in ascending order; postorder visits left, right and the root last.
Chapter 9: Graphs
Difficulty: Hard · Key topics: vertices and edges, in-degree and out-degree, adjacency matrix and list, BFS and DFS
Graphs close the book as the structure for many-to-many relationships that trees cannot express. The chapter defines vertices and edges, then works through the terminology: undirected and directed graphs, weighted graphs, degree, isolated and null graphs, in-degree and out-degree, source and sink nodes, paths and their length, loop edges, parallel edges, complete graphs and cycles. Transport and communication networks are used as the running example. Two representations are then compared — the adjacency matrix and the adjacency list — with a clear account of when each is the better choice, and the chapter ends with the two standard traversals, Breadth-First Search and Depth-First Search, along with the three states a vertex passes through.
Key Points:
- A graph is a set of vertices joined by edges, and it can represent many-to-many relationships that a tree cannot.
- An undirected graph has edges with no direction (undigraph); a directed graph has one-way edges (digraph).
- Degree is the number of edges at a node; a source node has out-degree but zero in-degree, a sink node has in-degree but zero out-degree.
- An adjacency matrix for N vertices is an N × N table of 0s and 1s, and it is symmetric when the graph is bidirectional.
- An adjacency list is an array of linked lists; it suits sparse graphs and makes inserting or deleting a node far easier than a matrix does.
- Breadth-First Search uses a queue and works outwards level by level; Depth-First Search uses a stack and follows one branch to its deepest point.
- During traversal every vertex is in one of three states: ready (1), waiting (2) or processed (3).
Memory Tip: Pair each search with the structure it uses — BFS with a Queue, both spreading sideways level by level, and DFS with a Stack, both going deep and coming back. The same pairing answers which search is written recursively: DFS.
Common Mistake: Swapping the two searches. DFS is the one that goes down a branch to its deepest point; BFS is the one that visits in layers. The chapter’s true/false items deliberately state both the wrong way round.
Important Questions:
- What is the difference between an adjacency matrix and an adjacency list? A matrix is an N × N table that answers “is there an edge between these two vertices” instantly but wastes space on sparse graphs; a list stores only the edges that exist and is easier to insert into or delete from.
- What is the difference between Breadth-First and Depth-First Search? BFS uses a queue and visits all the neighbours of a vertex before moving outwards a level; DFS uses a stack and follows a single branch as deep as it goes before backing up.
Download Data Structures in C++ PDF
Your free PDF is ready. Click the button below to download the complete Aikman Series Data Structures textbook.
↓ Download PDFHow to Study This Book
Start with Chapter 1, even if it looks easy. The algorithm notation introduced there — numbered steps, Repeat For, Repeat While, sub-algorithms — is used in every later chapter, so skipping it makes Chapters 4 to 9 harder than they need to be.
Mid-term (Chapters 1–5): Introduction, Arrays, Strings, Stacks and Queues. Chapter 4 is the heaviest of this half because recursion and postfix conversion both sit inside it — give it more time than the page count suggests.
Final term (Chapters 6–9): Searching & Sorting, Linked Lists, Trees and Graphs. Chapter 8 (Trees) is the longest in the book at 47 pages, so begin it at least two weeks before the paper instead of leaving it for revision week.
Follow the dependency order: Arrays → Stacks and Queues → Linked Lists → Trees → Graphs. Each of these builds directly on the one before it, and studying them out of order is the most common reason students find Trees confusing.
For every chapter, do the exercises. The fill-in-the-blanks and true/false items at the end of each chapter are written straight from the definitions, and short questions in university papers are usually built from the same lines.
Used In These Programs
This book is part of the Data Structures course in BSCS, BSIT and BSSE programs. Browse all Data Structures books, everything tagged BSCS, or the full Computer Science books section.
Who Should Read This
Written for BSCS, BSIT and BSSE students taking their first Data Structures course. It suits anyone who already knows basic C++ — loops, arrays and functions — and now needs the standard structures such as stacks, queues, linked lists, trees and graphs explained with running code rather than pure theory. Students preparing for university sessionals and finals will find the end-of-chapter exercises closest to actual paper style, and self-study learners can follow the concept → algorithm → program sequence without a teacher.
Applicable Universities
This book is widely used at Pakistani universities offering BSCS, BSIT and BSSE, including Punjab University, Virtual University, COMSATS, FAST, UET and other HEC-recognized institutions.
FAQs
Is this the Aikman Series Data Structures book for BSCS?
Yes. This is Data Structures in C++ by C M Aslam, published by Aikman Book Corporation, and it is used in the Data Structures course of BSCS, BSIT and BSSE programs.
How many chapters does the book have?
Nine, running from Introduction and Arrays through Strings, Stacks, Queues, Searching & Sorting, Linked Lists, Trees and Graphs across 241 pages.
Which data structures are covered in this book?
Arrays, strings, stacks, queues, deques and priority queues, single, double and circular linked lists, binary trees and binary search trees, and graphs with adjacency matrix and adjacency list representations.
Does it cover recursion and postfix conversion?
Yes, both are in Chapter 4 on Stacks, with algorithms, worked examples and complete C++ programs.
Are the programs written in C++?
Yes. Every algorithm is followed by a complete C++ program in the older iostream.h and conio.h style, compatible with Turbo C++ and Borland C++.
Does the page help with exam preparation?
Each chapter here carries key points, a memory or practice tip, a common mistake to avoid and two important questions with short answers, while the book itself ends every chapter with fill-in-the-blanks, true/false and programming exercises.
Related Books
- Database Management System PDF Download – BSCS University
- Object Oriented Programming Using C++ PDF Download – IT Series BSCS
- Key Book to OOP C++ Programming Exercises PDF Download – IT Series BSCS
- The Concepts of Information Technology PDF Download – IT Series (2nd Edition)
- Operating Systems and Networks PDF Download – IT Series BSCS (5th Edition)
- Number System & Boolean Algebra SN-2 Notes
Data Structures in C++ keeps the same rhythm in every chapter — concept, algorithm, program, exercises — which is what makes it workable for self-study. Download the PDF above and work through the exercises as you go. For more titles from the same semester, visit our Computer Science books section.
Data Structures in C++ by C M Aslam, published by Aikman Book Corporation, Urdu Bazar, Lahore. All rights remain with the publisher.
Assalamualaikum Sir.
I like your books too much but unfortunately I searched multiple places but I didn’t find. Sir how may I get your books.
Thank you.
Wa alaikum salaam. Please find the download button below.