CS301 Mid-term notes 1-22.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)
Tags
MIDTERM

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 CS301 Mid-term notes 1-22.pdf for free?

You can preview and download "CS301 Mid-term notes 1-22.pdf" (CS301 PDF, ~240 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs301-mid-term-notes-1-22-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

                     Made by ᵛᵘ £lon musk ᶠⁱˡᵉˢ
                     CS301 Mid term Notes
                            Lec 1 to 22
Data Structures   Lecture No. 01

Data structures

Data structures are used to store data in a computer in an organized form. In C++
language, Different types of data structures are; Array, Stack Queue, Linked List,
and Tree. Sorting technique is merge sort, shell sort, bubble sort, Quick sort,
Selection sort, Heap sort etc.

Organizing Data

    Any organization for a collection of records that can be searched, processed
     in any order, or modified.

    The choice of data structure and algorithm can make the difference between
     a program running in a few seconds or many days.

Data Structures

Data Structures are a specialized means of organizing and storing data in
computers in such a way that we can perform operations on the stored data more
efficiently.

Most Common 8 Data structures are as follows:

   1. Arrays
   2. Linked Lists
   3. Stacks
   4. Queues
   5. Hash Tables
   6. Trees
   7. Heaps
   8. Graphs

Arrays

An ordered and index able sequence of values. C++ supports arrays of a single
dimension (a vector) or of multiple dimensions. Elementary data structure that
exists as built-in in most programming languages.

#include <iostream>

using namespace std;

main( int argc, char** argv )

{

       int x[6];

       int j;

       for(j=0; j < 6; j++)

       x[j] = 2*j;

       }

Array operations

    1. Traverse: Go through the elements and print them.
    2. Search: Search for an element in the array. You can search the element by its
       value or its index.
    3. Update: Update the value of an existing element at a given index.

Inserting elements to an array and deleting elements from an array cannot be done
straight away as arrays are fixed in size. If you want to insert an element to an
array, first you will have to create a new array with increased size (current size +
1), copy the existing elements and add the new element. The same goes for the
deletion with a new array of reduced size.

Applications of arrays

    Used as the building blocks to build other data structures such as array lists,
     heaps, hash tables, vectors and matrices.
    Used for different sorting algorithms such as insertion sort, quick sort,
     bubble sort and merge sort.

The LIST Data Structure

    The List is among the most generic of data structures.

    Real life:

                  a. shopping list,

                  b. groceries list,

                  c. list of people to invite to dinner

                  d. List of presents to get

Lists                                                                      LONG OR
SHORT OR Quiz

    A list is collection of items that are all of the same type (grocery items,
     integers, names).

    The items, or elements of the list, are stored in some particular order.

    It is possible to insert new elements into various positions in the list and
     remove any element of the list.

    List is a set of elements in a linear order.
     For example, data values a1, a2, a3, a4 can be arranged in a list:

             (a3, a1, a2, a4)

      In this list, a3, is the first element, a1 is the second element, and so on

    The order is important here; this is not just a random collection of elements,
     it is an ordered collection.

List Operations                                                     FOR MCQ

Useful operations

    create List(): 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 (): return the length of the list.

What is meant by “particular position” we have used “?” for List Operations?
There are two possibilities:

         1. Use the actual index of element: insert after element 3, get element
            number 6. This approach is taken by arrays.

         2. Use a “current” marker or pointer to refer to a particular position in
            the list. If we use

The “current” marker, the following four methods would be useful:

start(): moves to “current” pointer to the very first element.
                                         tail(): moves to “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 Data Structures

Linked Lists

A linked list is a sequential structure that consists of a sequence of items in linear
order which is linked to each other. Hence, you have to access data sequentially
and random access is not possible. Linked lists provide a simple and flexible
representation of dynamic sets. Let’s consider the following terms regarding linked
lists.

• Elements in a linked list are known as nodes.

• Each node contains a key and a pointer to its successor node, known as next.

• The attribute named head points to the first element of the linked list.

• The last element of the linked list is known as the tail.

Following are the various types of linked lists available.

• Singly linked list — Traversal of items can be done in the forward direction only.

• Doubly linked list — Traversal of items can be done in both forward and
backward directions. Nodes consist of an additional pointer known as prev,
pointing to the previous node.

• Circular linked lists — Linked lists where the prev pointer of the head points to
the tail and the next pointer of the tail points to the head

Following are the various types of linked lists available.

• Singly linked list — Traversal of items can be done in the forward direction only.

More CS301 files

All CS301 files · Midterm Prep 2026 · MCQs Bank