- Type
- Final term past paper
- Course
- CS301 Data Structures
- Size
- PDF 995 KB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 1, 2, 3 of 36. Download the file for all 36 pages.
CS301 Data Structures Lecture Wise Questions and Answers For Final Term Exam Preparation By Virtualians Social Network
Lec 23:
Double rotation is simply making a single rotation twice, once left then right or vice versa. While inserting a node in an AVL tree, if we have to balance the tree, then we need to do only one single right, left or one double rotation to balance the tree.
In deletion from an AVL tree, we delete node as we delete it in a BST.
After deleting the node, we traverse up the tree from the deleted node checking the balance of each node at each level up to the root.
Deletion cases in AVL:
Case1a:
The parent of the deleted node had a balance of 0 and the node was deleted in the parent‟s left sub tree.
Action Change the balance of the parent node and stop.
parent‟s right sub tree.
Action change the balance of the parent node and stop.
Case2a: Parent of the deleted node had a balance of 1 and the node was deleted in the parent‟s left sub tree.
Action Change the balance of the parent node. This deletion of node may have caused imbalance in higher nodes so it is advised to continue up to the root of the tree.
Q.when we use " using namespace std" what does it mean? often time i hear the word only namespace, what is meant by namespace alone?
It is not mandatory to use using namespace std; in the beginning of your program, however it is better to use it. It is a combination of some objects, class and functions etc. Q. Why Hoffman tree is not an AVL Tree?
Ans
For a tree to be AVL, there are two conditions:
- Tree must be Binary Search Tree
- For every node, height of left and right subtree may differ by at most 1
For Huffman encoding, we also need a Binary tree to get the codes of characters. And we have different method to build that Binary tree. Very Important: Binary tree used in Huffman encoding is not even Binary Search Tree.
Q. Abstract data type (ADT)
Ans
Abstract data type (ADT): A data type whose properties (domain and operations) are specified independently of any particular implementation.
List, for example, is an ADT. The functionality of an ADT can be implemented in many ways. The programs that use these ADTs will not need to know which implementation was used as long as it performs the required functionality.
The List ADT can be implemented through Arrays (elementary data structure that exists as built-in in most programming languages) or linked-structure (list implemented through linked-structure is called Linked-list).
Programming languages provide some built-in data types, also called primitive data types. Like C++ language provides int, float, char etc as built-in data types. Lec : 24:
parent‟s right subtree.
Action Change the balance of the parent tree and in case the imbalance occurs in the higher nodes, continue up the tree.
Case 3a The parent had balance of -1 and the node was deleted in the parent‟s left subtree while right subtree was un-balanced.
Action Perform single rotaion, adjust balance. Balance of the higher nodes will not be affected so that‟s it.
Case 4a Parent had balance of -1 and the node was deleted in the parent‟s left subtree, right subtree was unbalanced.
Action Double rotation to bring the root(B) upwards.
Case 5a the parent had balance of -1 and the node was deleted in the parent‟s left subtree, right subtree was unbalanced.
Acction Single rotation at B. In case of unbalance, continue up the tree.
Expression trees Parse trees and abstract syntax trees , which are significant components of compilers.
The parse trees are used in query processing. The queries are questions to the database to see a particular kind of data. The language used to query is called SQL(Structured Query Language).
Optimizers use the expressions trees and convert them into graphs for efficiency purposes.
Related CS301 files
All CS301 files →- CS301 Final Term Solved MCQs with References Set 2 by Moaaz Final term PDF 376 KB
- CS301 Final Term Solved Subjective with References Set 2 by Moaaz Final term PDF 564 KB
- CS301 Final Term Solved Subjective Set 2 by Junaid Final term PDF 1.8 MB
- CS301 Final Term Quiz 4 July 2023 by Miss Mehwish Final term PDF 538 KB
- CS301 Highlighted Handouts by Qalb-e-Momin Highlighted PDF 7.1 MB
- CS301 Quiz Nov 2025 Quiz PDF 35 KB
Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.