CS301-lec22.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

  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)
  5. Object-Oriented Paradigms: Classes & Data Abstraction — Lectures 23 to 29 (Pages 281 to 360). 16% Final-Term Marks (Core OO Concepts)
  6. Inheritance Hierarchies & Dynamic Polymorphism — Lectures 30 to 36 (Pages 361 to 435). 20% Final-Term Marks (Virtual Functions & V-Tables)
  7. Templates, Standard Library & Persistent File I/O — Lectures 37 to 41 (Pages 436 to 510). 14% Final-Term Marks (Generic Code & Streams)
  8. 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-lec22.ppt for free?

You can preview and download "CS301-lec22.ppt" (CS301 PPT, ~450 pages) directly from the MIHORA VU Study Library (https://study.mihora.tech/doc/cs301-lec22-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

Data Structures

            Lecture 22
            Sohail Aslam

                           1

Cases for Rotation

  Single right rotation fails to fix case 2.
             k2                        k1

      k1                                            k2
                   Z   Level n-2   X

  X        Y           Level n-1              Y          Z

                       Level n
           new                                new

                                                         2

Cases for Rotation

                         Y is non-empty because
                          the new node was inserted
               k2
                          in Y.
      k1                 Thus Y has a root and two
                    Z     subtrees.
                         View the entire tree with
  X
                          four subtrees connected
           Y              with 3 nodes.

                                                 3

Cases for Rotation

                          Y is non-empty because
                           the new node was inserted
                k3
                           in Y.
      k1                  Thus Y has a root and two
                     D     subtrees.
           k2             View the entire tree with
  A
                           four subtrees connected
      B         C
                           with 3 nodes.

                                                  4

Cases for Rotation

                                                  Exactly one of tree B or C
                    k3
                                                   is two levels deeper than
     k1
                                                   D; we are not sure which
                                                   one.
              k2                                  Good thing: it does not
                                   D               matter.
 A                                                To rebalance, k3 cannot be
                                             1
          B          C
                                                   left as the root.
                                                 2

     new            new’

     New node inserted a either of the two
                                                                         5
     spots

Cases for Rotation

                                                 A rotation between k3
                    k3
                                                  and k1 (k3 was k2 then)
     k1                                           was shown to not work.
                                                 The only alternative is
              k2
                                   D
                                                  to place k2 as the new
                                                  root.
 A
          B          C
                                             1   This forces k1 to be k2‘s
                                               2  left child and k3 to be its
     new            new’
                                                  right child.
     New node inserted a either of the two
                                                                        6
     spots

Cases for Rotation
  Left-right double rotation to fix case 2.

                    k3                                                         k3

                                   Rotate left
      k1                                                        k2

               k2
                                                     k1                                         D
                           D
                                                                        C

  A
                               1                           B
           B        C

                                   2             A                     new’

                                                                     New node inserted a either of the two
       new          new’                                  new                               7
                                                                     spots

Cases for Rotation
  Left-right double rotation to fix case 2.

                              k3       Rotate right              k2

                  k2                                  k1                     k3

       k1                          D

                       C                                    B         C

                                                A                                     D
             B

   A                   new’                                new        new’

            new                                                                   8

Cases for Rotation

  Right-left double rotation to fix case 3.
          k1                 Rotate right       k1

                    k3                                   k2
  A                                         A
               k2                                             k3
                         D                           B

      B             C                                     C        D

                                                                       9

Cases for Rotation

  Right-left double rotation to fix case 3.
        k1                 Rotate left                k2

                 k2                          k1                k3
   A
                      k3
                                                  B        C        D
             B                           A

                  C        D

                                                                        10

AVL Tree Building Example

 Insert(15)           4

              2                   6

        1         3       5            7 k1

                                            16 k2
                                X
                              (null)
                                                  Z
                                       Y        (null)

More CS301 files

All CS301 files · Midterm Prep 2026 · MCQs Bank