- Type
- Quiz
- Course
- CS301 Data Structures
- Size
- PDF 1.3 MB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extension for 30 a day.
Preview text
Text from pages 1, 2, 3 of 44. Download the file for all 44 pages.
Single right rotation
Is applied when a node is insert in right subtree.
ALGORITHM:
STEP 1: START.
STEP 2: INITIALIZE arr[] ={1, 2, 3, 4, 5 }.
STEP 3: length= sizeof(arr)/sizeof(arr[0])
STEP 4: SET n =3.
STEP 5: PRINT " Original Array"
STEP 6: SET i=0. REPEAT STEP 7 and STEP 8 UNTIL i<length.
STEP 7: PRINT arr[i]
STEP 8: i=i+1.
Single left rotation
Is applied when a node is inserted in a left subtree
ALGORITHM:
STEP 1: START.
STEP 2: INITIALIZE arr[] ={1, 2, 3, 4, 5 }.
STEP 3: length = sizeof(arr1)/sizeof(arr1[0])
STEP 4: length = sizeof(arr)/sizeof(arr[0])
STEP 5: SET n =3.
STEP 6: SET i=0. REPEAT STEP 7 to STEP 8 UNTIL i<length.
STEP 7: PRINT arr[i]
STEP 8: i = i+1.
A double right rotation, or right-left rotation, or simply RL, is a rotation that must be performed when attempting to balance a tree which has a left subtree, that is right heavy. This is a mirror operation of what was illustrated in the section on Left-Right Rotations, or double left rotations.
Double left right rotation Carries out single left rotation at first
Deleting a node from an AVL tree is similar to that in a binary search tree. Deletion may disturb the balance factor of an AVL tree and therefore the tree needs to be rebalanced in order to maintain the AVLness. For this purpose, we need to perform rotations Other uses of binary trees
Binary Search Tree is a tree that allows fast search, insert, delete on a sorted data. It also allows finding closest item. Heap is a tree data structure which is implemented using arrays and used to implement priority queues. B-Tree and B+ Tree: They are used to implement indexing in databases.
An expression tree is a representation of expressions arranged in a tree-like data structure
Parse tree is the hierarchical representation of terminals or non-terminals. These symbols (terminals or non-terminals) represent the derivation of the grammar to yield input strings. ... The starting symbol of the grammar must be used as the root of the Parse Tree. Leaves of parse tree represent terminals
Parse tree for an SQL Query
A parse tree is a data structure for representing a parsed statement. Parsing a statement requires the grammar of the language (quest language, e.g., MySQL, MS-SQL, etc.) that the statement was written.
In computing , an optimizing compiler is a compiler that tries to minimize or maximize some attributes of an executable computer program. Common requirements are to minimize a program's execution time, memory footprint, storage size, and power consumption
An expression tree is a representation of expressions arranged in a tree-like data structure. In other words, it is a tree with leaves as operands of the expression and nodes contain the operators. Similar to other data structures, data interaction is also possible in an expression tree.
Huffman coding is a lossless data compression algorithm. The idea is to assign variable-length codes to input characters, lengths of the assigned codes are based on the frequencies of corresponding characters. The most frequent character gets the smallest code and the least frequent character gets the largest code.
*Huffman encoding*is used in data compression.
Mathematical properties of binary tree The path length of a tree is the sum of the levels of all the tree's nodes. The internal path length of a binary tree is the sum of the levels of all the tree's internal nodes. The external path length of a binary tree is the sum of the levels of all the tree's external nodes.
Let's now focus on some basic properties of a binary tree:
A binary tree can have a maximum of nodes at level if the level of the root is zero.
When each node of a binary tree has one or two children, the number of leaf nodes (nodes with no children) is one more than the number of nodes that have two children.
In computing, a threaded binary tree is a binary tree variant that facilitates traversal in a particular order. An entire binary search tree can be easily traversed in order of the main key, but given only a pointer to a node, finding the node which comes next may be slow or impossible.
A threaded insert, also known as a threaded bushing, is a fastener element that is inserted into an object to add a threaded hole.
In Binary Tree, Inorder successor of a node is the next node in Inorder traversal of the Binary Tree. ... In Binary Search Tree, Inorder Successor of an input node can also be defined as the node with the smallest key greater than the key of the input node
Inorder traversal
Definition: Process all nodes of a tree by recursively processing the left subtree, then processing the root, and finally the right subtree. Also known as symmetric traversal
Inorder traversal in threaded trees: inorder routine =left
/* The inorder routine for threaded binary tree */
TreeNode* nextInorder(TreeNode* p){
if(p->RTH == thread) return(p->R);
else {
p = p->R;
while(p->LTH == child)
p = p->L;
return p;
Related CS301 files
All CS301 files →- CS301 Highlighted Handouts by Qalb-e-Momin Highlighted PDF 7.1 MB
- CS301 Final Term Current Paper by VU Topper RM Final term PDF 74 KB
- CS301 Quiz 2 Set 3 Quiz PDF 1.9 MB
- CS301 Quiz 2 by Junaid Quiz PDF 727 KB
- CS301 Solved Grand Quiz 2021 by Sonu Ilyas Quiz PDF 2.4 MB
- CS301 Quiz 3 Set 2 by VU Topper RM Quiz PDF 388 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.