CS301DataStructuresMidTermNotes.pdf

Verified academic study resource for CS301 (Data Structures) under the Computer Science at Virtual University of Pakistan. This PDF document (Midterm Solved Past Paper & Revision File) covers Mid-Term Exam Scope (Lectures 1 to 22) spanning approximately 240 pages across 4 curriculum modules, and is indexed for student examination review with instant in-browser preview and 100% free direct download.

Course
CS301 – Data Structures
Faculty
Computer Science
Format
PDF
Type
Midterm
Coverage
Mid-Term Exam Scope (Lectures 1 to 22)

Focus on core definitions and repeated MCQs from Lectures 1–22. Remember that scoring in the First Half builds your safety buffer toward the mandatory 20% Two-Half passing rule in CS301.

What this file covers — CS301 syllabus roadmap

  1. Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
  2. Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
  3. Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
  4. Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)

Frequently asked questions

Where can I download CS301DataStructuresMidTermNotes.pdf for free?

You can preview and download "CS301DataStructuresMidTermNotes.pdf" (CS301 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs301datastructuresmidtermnotes-pdf) with 100% free high-speed downloads and zero registration requirements.

What syllabus chapters and lectures are covered in this CS301 file?

This document covers Mid-Term Exam Scope (Lectures 1 to 22) across 4 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22), featuring comprehensive definitions, solved objective questions, and examiner marking rubrics.

What is the passing criteria for CS301 under the VU 20% Two-Half Rule?

Under official Virtual University regulations, students must score at least 20% in the First Half (Quizzes, Assignments, GDBs, and Midterm combined) AND independently at least 20% in the Final-Term examination paper. Scoring under 20% in the final exam results in an automatic F grade regardless of earlier marks.

Are CS301 solved past papers and handouts verified for 2026 exams?

Yes. All CS301 materials on MIHORA VU—including Moaaz, Waqar Siddhu, and team archives—are reviewed against the current VU syllabus to help students prepare for 2026 Midterm, Final-Term, and online quiz examinations.

Inside this file

                                                    Data Structure CS301
Lecture No. 01
Introduction to Data Structures: Data structures help us to organize the data in the computer, resulting
in more efficient programs. An efficient program executes faster and helps minimize
the usage of resources like memory, disk.
What does organizing the data mean?
It means that the data should be arranged in a way that it is easily accessible.
Data Structure Philosophy
a data structure may be better than another one in all situations.
There are three basic things associated with data structures. A data structure requires:
     1. space for each data item it stores
     2. time to perform each basic operation
     3. programming effort
What is x? x is a name of collection of items.                int x[6];
‘x’ is an array’s name but there is no variable x. ‘x’ is not an lvalue. If some variable can be written on the left-hand side
of an assignment statement, this is lvalue variable.
List data structure
The List data structure is among the most generic of data structures. A list is the collection of items of the same type. The
items, or elements of the list, are stored in some particular order. List is a set of elements in a linear order.
  Operation Name                           Description
  createList()                             Create a new list (presumably empty)
  copy()                                   Set one list to be a copy of another
  clear();                                 Clear a list (remove all elements)
  insert(X, ?)                             Insert element X at a particular position in the list
  remove(?)                                Remove element at some position in the list
  get(?)                                   Get element at a given position
  update(X, ?)                             Replace the element at a given position with X
  find(X)                                  Determine if the element X is in the list
  length()                                 Returns the length of the list.
If we use the “current” marker, the following four methods would be useful:
  Functions       Description
  start()         Moves the “current” pointer to the very first element
  tail()          Moves the “current” pointer to the very last element
  next()          Move the current position forward one element
  back()          Move the current position backward one element

Lecture No. 02
How to implement the interface. Suppose we want to create a list of integers. For this purpose, the methods of the list can
be implemented with the use of an array inside.
         for simplification purposes, it is good to use the index from 1.
Add Method
To add the new element (9) to the list at the current position, at first, we have to make space for this element. For this
purpose, we shift every element on the right of 8 (the current position) to one place on the right.            (2, 6, 8, 9, 7, 1)
Now in the second step, we put the element 9 at the empty space i.e. position 4.
next Method
We have talked that the next method moves the current position one position forward. In this method, we do not add a
new element to the list but simply move the pointer one element ahead.
remove Method
We have seen that the add method adds an element in the list. The remove method removes the element residing at the
current position.
find Method
The find
(x) function is used to find a specific element in the array. We pass the element, which is to be found, as an argument to
the find function. This function then traverses the array until the specific element is found. If the element is found, this

function sets the current position to it and returns 1 i.e. true. On the other hand, if the element is not found, the function
returns 0 i.e. false. This indicates that the element was not found. Following is the code of this find(x) function in C++.
int find (int x)
{
          int j ;
          for (j = 1; j < size + 1; j++ )
                    if (A[j] == x )
                             break ;
          if ( j < size + 1) // x is found
{
          current = j ; //current points to the position where x found
          return 1 ; // return true
}
          return 0 ; //return false, x is not found
}
get() method , used to get the element from the current position in the array.
method length( ).This method returns the size of the list.
back() method decreases the value of variable current by 1. In other words, it moves the current position one element
backward.                              current -- ;
The start() method sets the current position to the first element of the list.
Analysis of Array List
Time is the major factor to see the efficiency of a program.
List using Linked Memory
In an array, the memory cells of the array are linked with each other. It means that the memory of the array is contiguous.
In an array, it is impossible that one element of the array is located at a memory location while the other element is
located somewhere far from it in the memory. It is located in very next location in the memory.
Linked List
For the utilization of the concept of linked memory, we usually define a structure, called linked list. To form a linked list,
at first, we define a node. A node comprises two fields. i.e. the object field that holds the actual list element and the next
that holds the starting location of the next node.
A chain of these nodes forms a linked list.
We use head and current variable names instead of using the memory address in numbers for starting and the current
nodes.
Lecture No. 03
There is the limitation that array being of fixed size can only store a fixed number of elements. Therefore, no more
elements can be stored after the size of the array is reached.
In order to resolve this, we adopted a new data structure called linked list.
Linked List Operations
The linked list data structure provides operations to work on the nodes inside the list. The Add(9) is used to create a new
node in the memory at the current position to hold ‘9’. You must remember while working with arrays, to add an element

More CS301 files

All CS301 files · Midterm Prep 2026 · MCQs Bank