CS301-lec41.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-lec41.ppt for free?
You can preview and download "CS301-lec41.ppt" (CS301 PPT, ~450 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs301-lec41-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
Skip List: Implementation
S3
S2 34
S1 23 34
S0 12 23 34 45
Lecture No.41
Data Structure
Dr. Sohail Aslam
Implementation: TowerNode
head
Tower Node
tail
20 26 30 40 50 57 60
TowerNode will have array of next pointers.
Actual number of next pointers will be
decided by the random procedure.
Define MAXLEVEL as an upper limit on
number of levels in a node.
Implementation: QuadNode
A quad-node stores:
• item
quad-node
• link to the node before
• link to the node after
• link to the node below
• link to the node above
x
This will require copying the
key (item) at different levels
Skip Lists with Quad Nodes
S3
S2 31
S1 23 31 34 64
S0 12 23 26 31 34 44 56 64 78
Performance of Skip Lists
In a skip list with n items
• The expected space used is proportional
to n.
• The expected search, insertion and
deletion time is proportional to log n.
Skip lists are fast and simple to implement
in practice
Implementation 5: AVL tree
An AVL tree, ordered by key
key entry
insert: a standard insert; (log n)
find: a standard find (without
removing, of course); (log n) key entry key entry
remove: a standard remove;
(log n) key entry
and so on
Anything better?
So far we have find, remove and insert
where time varies between constant logn.
It would be nice to have all three as
constant time operations!
Implementation 6: Hashing
An array in which
TableNodes are not stored key entry
consecutively
Their place of storage is
4
calculated using the key and
a hash function
10
hash array
Key index
function
123
Keys and entries are
scattered throughout the
array.
Hashing
insert: calculate place of
storage, insert
key entry
TableNode; (1)
find: calculate place of
4
storage, retrieve entry;
(1) 10
remove: calculate place
of storage, set it to null;
(1) 123
All are constant time (1) !
Hashing
We use an array of some fixed size T to
hold the data. T is typically prime.
Each key is mapped into some number
in the range 0 to T-1 using a hash
function, which ideally should be
efficient to compute.
Example: fruits
Suppose our hash function
0 kiwi
gave us the following 1
values: 2 banana
hashCode("apple") = 5 3 watermelon
hashCode("watermelon") = 3
4
hashCode("grapes") = 8
hashCode("cantaloupe") = 7 5 apple
hashCode("kiwi") = 0 6 mango
hashCode("strawberry") = 9 7 cantaloupe
hashCode("mango") = 6
hashCode("banana") = 2 8 grapes
9 strawberry
Example
Store data in a table 0 kiwi
1
array:
table[5] = "apple"
2 banana
table[3] = "watermelon" 3 watermelon
table[8] = "grapes" 4
table[7] = "cantaloupe" 5 apple
table[0] = "kiwi"
table[9] = "strawberry" 6 mango
table[6] = "mango" 7 cantaloupe
table[2] = "banana" 8 grapes
9 strawberry
Example
Associative array: 0 kiwi
1
table["apple"]
2 banana
table["watermelon"]
table["grapes"]
3 watermelon
4
table["cantaloupe"]
table["kiwi"] 5 apple
table["strawberry"] 6 mango
table["mango"] 7 cantaloupe
table["banana"] 8 grapes
9 strawberry
Example Hash Functions
If the keys are strings the hash function is
some function of the characters in the
strings.
One possibility is to simply add the ASCII
values of the characters:
length 1
h( str ) str[i ] %TableSize
i0
Example : h( ABC ) (65 66 67)%TableSize
Finding the hash function
int hashCode( char* s )
{
int i, sum;
sum = 0;
for(i=0; i < strlen(s); i++ )
sum = sum + s[i]; // ascii value
return sum % TABLESIZE;
}
Example Hash Functions
Another possibility is to convert the string
into some number in some arbitrary base b
(b also might be a prime number):
length 1 i
h( str ) str[i ]b %T
i0
0
Example : h( ABC ) (65b 66b 67b )%T
1
2
Example Hash Functions
If the keys are integers then key%T is
generally a good hash function, unless the
data has some undesirable features.
For example, if T = 10 and all keys end in
zeros, then key%T = 0 for all keys.
In general, to avoid situations like this, TMore 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)