CS301-lec43.ppt
Verified academic study resource for CS301 (Data Structures) under the Computer Science at Virtual University of Pakistan. This PPT document (Official Lecture Handouts & Highlighted Notes) covers Complete Course Handouts (Lectures 1 to 45) spanning approximately 450 pages across 8 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
- PPT
- Type
- Handout
- Coverage
- Complete Course Handouts (Lectures 1 to 45)
- Tags
- SLIDES
Virtual University examiners construct 100% of objective MCQs and subjective marking schemes directly from the official CS301 handouts.
What this file covers — CS301 syllabus roadmap
- Core Architecture, Syntax & Primitive Data Structures — Lectures 1 to 6 (Pages 1 to 65). 15% Objective Marks (8–10 MCQs)
- Conditional Branching, Loops & Logical Control Flow — Lectures 7 to 12 (Pages 66 to 140). 18% Exam Marks (MCQs + 2-Mark Short Questions)
- Memory Management, Pointers, Arrays & Functions — Lectures 13 to 18 (Pages 141 to 215). 22% Exam Marks (High Yield for Midterms)
- Midterm Consolidation, Strings & Algorithm Synthesis — Lectures 19 to 22 (Pages 216 to 280). Midterm Exam Culmination (Lectures 1–22 Scope)
- Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
- Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
- Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
- Final-Term Examination Dossier & Capstone Synthesis — Lectures 42 to 45 (Pages 511 to 585). Final-Term Exam Synthesis (Lectures 23–45 Scope)
Frequently asked questions
Where can I download CS301-lec43.ppt for free?
You can preview and download "CS301-lec43.ppt" (CS301 PPT, ~450 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs301-lec43-ppt) with 100% free high-speed downloads and zero registration requirements.
What syllabus chapters and lectures are covered in this CS301 file?
This document covers Complete Course Handouts (Lectures 1 to 45) across 8 distinct lecture units (Lectures 1 to 6, Lectures 7 to 12, Lectures 13 to 18, Lectures 19 to 22, Lectures 23 to 29, Lectures 30 to 36, Lectures 37 to 41, Lectures 42 to 45), 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
Lecture No.43
Data Structures
Dr. Sohail Aslam
Recap
Collision Strategies in Hashing
Linear Probing
Quadratic Probing
Linked List chaining
Hashing Animation
Let’s see the hashing animation. We will see linear probing, quadratic probing and
link list chaining in it. This is an example of how do we solve collision.
We have an array shown in four different columns. The size of the array is 100
and the index is from 0 to 99. Each element of the array has two locations so we
can store 200 elements in it. When we have first collision the program will use the
2nd part of the array location. When there is a 2nd collision the data is stored
using the linear probing. At the top right corner we have hash function x and its
definition is “mod 100”. That is when a number is passed to it, it will take mod with
100 and return the result which is used as index of the array.
In this example we are using numbers only and not dealing with the characters.
We also have a statistical table on the right side. This program will generate 100
random numbers and using the hash function it will store these in the array. The
numbers will be stored in the array at different locations. In the bottom left we
have hashing algorithms. We have chosen the linear probing. Now the program
will try to solve this problem using the linear probing. Press the run button to start
it. It is selecting the numbers randomly, dividing it by 100 and the remainder is the
hash value which is used as array index.
Here we have number 506. It is divided by 100 and the remainder is 6. It means
that this number will be stored at the sixth array location. Similarly we have a
number 206, now its remainder is also 6. As location 6 is already occupied so we
will store 206 at the 2nd part of the location 6. Now we have the number 806. Its
remainder is also 6. As both the parts of location 6 are occupied. Using the linear
probing we will store it in the next array location i.e. 7. If we have another number
having the remainder as 6, we will store it at the 2nd part of location 7. If we have
number 807, its remainder is 7. The location 7 is already occupied due to the
linear probing. Therefore the number 807 will be stored using the linear probing in
the location 8.
Hashing Animation
Let’s change the collision resolution algorithm to quadratic probing. Run the
animation again. Now we have array size as 75 and the array is shown in
three columns. Each location of the array can store two numbers. In quadratic
probing we add square of one first i.e. 1 and then the square of two and so on
in case of collisions. Here we have used a different hash function. We will take
the mod with 75. When the both parts of the array location is filled we will use
the quadratic probing to store the next numbers. Analyze the numbers and
see where the collisions have happened.
Lets see the animation using the linked list chaining. Now the hash function
uses 50 to take mod with the numbers. So far pointers are not shown. When
both parts of the location are filled, we will see the link list appearing. We have
four numbers having remainder 0. The two numbers will be stored in the array
and the next two will be stored using the link list which is attached at the 0
location.
We are not covering the hashing topic in much depth here as it is done in
algorithms and analysis of algorithms domain. This domain is not part of this
course. For the time being, we will see the usage of hashing. For certain
situations, table ADT can be used, which internally would be using hashing.
Applications of Hashing
Compilers use hash tables to keep track of
declared variables (symbol table).
A hash table can be used for on-line
spelling checkers — if misspelling detection
(rather than correction) is important, an
entire dictionary can be hashed and words
checked in constant time.
Applications of Hashing
Game playing programs use hash tables to
store seen positions, thereby saving
computation time if the position is
encountered again.
Hash functions can be used to quickly
check for inequality — if two elements hash
to different values they must be different.
When is hashing suitable?
Hash tables are very good if there is a need for
many searches in a reasonably stable table.
Hash tables are not so good if there are many
insertions and deletions, or if table traversals are
needed — in this case, AVL trees are better.
Also, hashing is very slow for any operations
which require the entries to be sorted
• e.g. Find the minimum key
Sorting Integers
How to sort the integers in this array?
20 8 5 10 7
5 7 8 10 20
Elementary Sorting Algorithms
Selection Sort
Insertion Sort
Bubble Sort
Selection Sort
Main idea:
• find the smallest element
• put it in the first position
• find the next smallest element
• put it in the second position
•…
And so on, until you get to the end of the list
More CS301 files
- CS301 & CS301P Short Notes By Qalb-e-Momin .pdf (PDF · Handout)
- CS301 Handouts (Updated) by MS.pdf (PDF · Handout)
- CS301 Handouts by MS S26.pdf (PDF · Handout)
- CS301 Handouts by MS.pdf (PDF · Handout)
- CS301 Handouts by MS.pdf (PDF · Handout)
- CS301 HighLight Notes.pdf (PDF · Handout)
- CS301 Highlight Handout By Vu Topper RM.pdf (PDF · Handout)
- CS301 Highlight Handout By Vu Topper RM.pdf (PDF · Handout)