0% found this document useful (0 votes)
22 views25 pages

Tree - DPP 02 - Merged

The document contains a series of multiple-choice questions (MCQs) and natural language questions (NAT) related to binary trees and their traversals, including concepts like binary search trees and tree functions. It provides answer keys and hints for solving the problems presented. The content is structured for students in a Computer Science and IT program, focusing on data structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views25 pages

Tree - DPP 02 - Merged

The document contains a series of multiple-choice questions (MCQs) and natural language questions (NAT) related to binary trees and their traversals, including concepts like binary search trees and tree functions. It provides answer keys and hints for solving the problems presented. The content is structured for students in a Computer Science and IT program, focusing on data structures.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

1

Branch : CSE/IT Batch : Hinglish


Data Structure
Tree DPP-02

[MCQ]
1. Consider the following nested representation of binary
trees: (X Y Z) indicates Y and Z are the left and right
sub stress, respectively, of node X. Note that Y and Z
may be NULL, or further nested. Which of the
following represents a valid binary tree?
(a) (1 2 (4 5 6 7))
(b) (1 (2 3 4) 5 6) 7)
(c) (1 (2 3 4) (5 6 7)) The in-order traversal of T is-
(d) (1 (2 3 NULL) (4 5)) (a) 7 1 3 4 6 5 2 8
(b) 4 1 6 7 3 2 5 8
[MCQ] (c) 4 6 1 2 8 5 3 7
2. Consider the following two statements: (d) 7 1 4 6 3 5 2 8
S1: It is possible to construct a binary tree uniquely
whose post-order and pre-order traversals are given. [MCQ]
S2: It is possible to construct a binary tree uniquely 5. Consider the following binary tree T-
whose in-order and pre-order traversals are given.
S3: It is possible to construct a binary tree uniquely
whose post-order and level-order traversals are given.
Which of the following statement(s) IS/ARE
INCORRECT?
(a) S1 only
(b) S2 only
(c) S1 and S3
(d) S3 only The pre-order traversal of T is-
(a) 7 1 3 4 6 5 2 8
[MCQ] (b) 4 1 6 7 3 2 5 8
3. Let LASTPOST, LASTIN and LASTPRE denote the (c) 4 6 1 2 8 5 3 7
last vertex visited in a postorder, inorder and preorder (d) 7 1 4 6 3 5 2 8
traversal respectively, of a complete binary tree.
Which of the following is always true? [MCQ]
(a) LASTIN = LASTPOST 6. Consider the following binary tree T-
(b) LASTIN = LASTPRE
(c) LASTPRE = LASTPOST
(d) None of the above

[MCQ]
4. Consider the following binary tree T-

The post-order traversal of T is-


2

(a) 71346528
(b) 41673258 [MCQ]
(c) 46128537 8. The post-order traversal of a binary tree is 9, 7, 4, 8,
(d) 71463528 2, 5, 1, 3, 6. The in-order traversal of the same tree is
9, 7, 8, 4, 5, 2, 6, 3, 1. The pre-order traversal of the
[NAT] above binary tree is-
7. The pre-order traversal of a binary tree is 1, 2, 4, 7, 8, (a) 1, 2, 4, 7, 9, 8, 5, 3, 6
3, 5, 6, 9. The in-order traversal of the same tree is 7 (b) 1, 2, 4, 7, 8, 9, 5, 3, 6
4 8 2 1 5 3 6 9. The height of a tree is the length of the (c) 1, 2, 3, 4, 5, 6, 7, 8, 9
longest path from the root to any leaf. The height of (d) None of the above.
the binary tree above is ______.
3

Answer Key
1. (c) 6. (c)
2. (c) 7. (3)
3. (d) 8. (a)
4. (b)
5. (d)
4

Hints and Solutions

1. (c) 6. (c)
Correct The post-order traversal of T is - 4 6 1 2 8 5 3 7

7. (3)

2. (c)
It is possible to construct a binary tree uniquely whose
in-order and pre-order/post-order traversals are given.
Height of the above binary tree = 3
3. (d)
8. (a)

In order: 1 4 2 6 3 5
Pre-order: 6 4 1 2 5 3
Post-order: 1 2 4 3 5 6
Clearly, LASTIN  LASTPRE  LASTPOST

4. (b)
The in-order traversal of T is- 4 1 6 7 3 2 5 8

5. (d)
The pre-order traversal of T is- 7 1 4 6 3 5 2 8 The pre-order traversal of the above binary tree is-
1, 2, 4, 7, 9, 8, 5, 3, 6

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Data Structure
Tree DPP 03

[NAT] if(t==NULL) return 1;


1. The number of unlabelled binary trees possible with else if(t->left==NULL && t->right==NULL)
four nodes is _________. return 1;
else if
[NAT] ((t → left → data < t->data) && (t → right → data > t-
2. The number of labelled binary trees possible with the >data))
nodes-10, 30, 25, 40 is _________. return func(t->left) && func(t->right);
else
[NAT] return 0;
3. The number of binary search trees possible with the }
nodes-10, 30, 25, 40 is _________. Assume t contains the address of the root node of a tree.
The function-
[MCQ] (a) Returns 1 if the given tree is a Binary Search Tree.
4. The pre-order traversal of a binary search tree is given (b) Returns 0 if the given tree is a complete binary
as- tree.
7, 3, 2, 1, 5, 4, 6, 8, 10, 9, 11 (c) Returns 0 if the given tree is a Binary Search Tree.
The post-order traversal of the above binary tree is- (d) Returns 1 if the given tree is a complete binary
(a) 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 tree.
(b) 1, 2, 4, 6, 5, 3, 9, 11, 10, 8, 7
(c) 1, 2, 4, 5, 6, 3, 9, 10, 11, 8, 7 [MCQ]
(d) 11, 9, 10, 8, 6, 4, 5, 1, 2, 3, 7 7. Consider the following function:
struct treenode{
[MCQ] struct treenode *left;
5. Consider the following two statements: int data;
Statement P: The last elements in the pre-order and in- struct treenode *right;
order traversal of a binary search tree are always same. };
Statement Q: The last elements in the pre-order and in- struct treenode * f(struct treenode *t, int x){
order traversal of a binary tree are always same. if(t==NULL) return NULL;
Which of the following tree is/are CORRECT? elseif(x==t->data) return ______a______;
(a) Both P and Q only else if (x<t->data) return ______b______;
(b) Neither P nor Q else return ______c______;
(c) Q only }
(d) P only Assume t contains the address of the root node of a
[MCQ] binary search tree. The function finds an element x in
6. Consider the following function: the BST and returns the address of the node if found.
struct treenode{ Which of the following statement(s) is/are CORRECT?
struct treenode *left; (a) a: NULL ; b: f(t->left, x) ; c: f(t->right, x)
int data; (b) a: t ; b: f(t->right, x) ; c: f(t->left, x)
struct treenode *right; (c) a: NULL ; b: f(t->right, x) ; c: f(t->left, x)
}; (d) a: t ; b: f(t->left, x) ; c: f(t->right, x)
int func (struct treenode *t){
2

Answer Key
1. (14) 5. (b)
2. (336) 6. (a)
3. (14) 7. (d)
4. (b)
3

Hint & Solutions


1. (14)
Number of unlabelled binary trees possible with 4
nodes
1 (2  4)!
= 
4 + 1 4! 4!
1 8!
= 
5 4! 4!
2
1 8 7 6  5
= 
5 4  3  2 1
= 14 Post-order traversal-
1 2 4 6 5 3 9 11 10 8 7
2. (336)
Number of labelled binary trees possible with 5. (b)
4 nodes- P: INCORRECT. The last elements in the pre-order
= 4! × Number of unlabelled binary trees with and in-order traversal of a binary search tree are not
4 nodes always same.(It violates for skewed BSTs)
= 4! × 14 Q: INCORRECT. The last elements in the pre-order
= 336 and in-order traversal of a binary tree are not always
same.
3. (14)
6. (a)
Number of BSTs with 4 = Number of unlabelled
binary trees with nodes The function- Returns 1 if the given tree is a Binary
Search Tree.

4. (b)
7. (d)
Pre-order traversal of BST:
struct treenode{
7 3 2 1 5 4 6 8 10 9 11
struct treenode *left;
In-order traversal of BST:
int data;
1 2 3 4 5 6 7 8 9 10 11
struct treenode *right;
Tree is constructed as-
};
void f(struct treenode *t, int x){
if(t==NULL) return NULL;
elseif(x==t->data) return t;
else if (x<t->data) return f(t->left, x);
else return f(t->right, x);
}

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

CSE/IT Batch-Hinglish
Data Structure
Tree DPP-04

[MCQ] (a) Returns 1 iff the two trees are identical.


1. Consider the following function: (b) Returns 1 iff the two trees are mirror images of
each other.
struct treenode
(c) Returns 1 iff the two trees emerge from the same
{
root node.
struct treenode *left;
(d) None of the above
int data;
struct treenode *right;
[MCQ]
};
3. Consider the following function:
int func(struct treenode *p, struct treenode *q){
if(p==NULL && q==NULL) return 1; struct treenode
if((!p && q) || (!q && p)) return 0; {
return (p->data==q->data) && func(p->left, q->right) struct treenode *left;
&& func(p->right, q->left); int data;
} struct treenode *right;
Initially the addresses of root node of two trees are };
passed into p and q respectively, the function- int func(struct treenode *p)
(a) Returns 1 iff the two trees are identical. {
(b) Returns 1 iff the two trees are mirror images of if(p==NULL) return 1;
each other. else if(p->right!=NULL) return 0;
return func(p->left);
(c) Returns 1 iff the two trees emerge from the same
}
root node.
(d) None of the above. Initially p contains the root node address of the tree, the
function-
[MCQ] (a) Returns 1 if a binary tree is left-skewed.
2. Consider the following function: (b) Returns 1 if a binary tree is right-skewed.
(c) Returns 1 if a binary tree is not right-skewed.
struct treenode
(d) None of the above.
{
struct treenode *left;
[MCQ]
int data;
4. Consider the following functions:
struct treenode *right;
}; struct treenode
int func(struct treenode *p, struct treenode *q){ {
if(p==NULL && q==NULL) return 1; struct treenode *left;
if((!p && q) || (!q && p)) return 0; int data;
return (p->data==q->data) && func(p->left, q->left) struct treenode *right;
&& func( p->right, q->right); };
} int f1(struct treenode *t)
Initially the addresses of root node of two trees are {
passed into p and q respectively, the function- if(t==NULL) return 1;
else if(t->left!=NULL) return 0;
2

return func(t->right); [MCQ]


} 6. The given tree is passed to the following function:
int * f2 (struct treenode *t){
if(t==NULL) return 1;
else if(t->left==NULL && t->right==NULL)
return 1;
else if
((t → left → data < t->data) && (t → right → data > t-
>data))
return func(t->left) && func(t->right);
else void func(struct treenode *t)
return 0; {
} if(t)
int f3(){return f2(t) && f1(t);} {
Assume, t is a pointer to the root node of a binary tree, printf(“%d”, t->data);
the function f(3): func(t->right);
(a) Returns 1 if the binary tree is a left-skewed BST printf(“%d”, t->data);
(b) Returns 1 if the binary tree is not a left-skewed func(t->left);
BST }
(c) Returns 1 if the binary tree is a right-skewed BST }
(d) None of the above. The output string is-
(a) AEFFEBDDCCBA
[MCQ] (b) AEFFEABDDBCC
5. Consider the following function: (c) AEFFEBDDCCBA
struct treenode (d) None of the above
{
struct treenode *left; [MCQ]
int data; 7. Consider the following function:
struct treenode *right; struct treenode
}; {
int func(struct treenode *t) struct treenode *left;
{ int data;
if(t==NULL) return 0; struct treenode *right;
elseif(t->left==NULL && t->right==NULL) };
return 1; void func(struct treenode *p){
else while(p->left!=NULL) p=p->left;
return 1+func(t->left)+func(t->right); printf(“%d”, p->data);
} }
Assume, t is a pointer to the root node of a binary tree, If the address of the root node of the BST is passed to
the function computes- p, the above function prints-
(a) Number of leaf nodes in the binary tree (Assume, the tree contains at least one node)
(b) Number of internal nodes in the binary tree (a) The maximum element in the BST
(c) Total number of nodes in the binary tree (b) The ancestor of two leftmost leaf nodes
(d) None of the above (c) The minimum element in BST
(d) None of the above
3

(c) Both P and Q (d) Neither P nor Q


[MCQ]
8. Consider the following two statements:
P: The minimum number of nodes in a complete binary
tree is 2h+1.
Q: A binary search tree is always a complete binary
tree.
Which of the statement(s) is/are CORRECT?
(a) P only (b) Q only
4

Answer Key
1. (b) 5. (c)
2. (a) 6. (b)
3. (a) 7. (c)
4. (c) 8. (d)
5

Hints and Solutions

1. (b)
The function returns 1 iff the two trees are mirror 6. (b)
images of each other. The output string is “AEFFEABDDBCC”.

2. (a) 7. (c)
The function returns 1 iff the two trees are identical The function returns the minimum element in a binary
each other. search tree.

3. (a) 8. (b)
The function returns 1 iff the binary tree is left-skewed.
P: INCORRECT. The minimum number of nodes in a
4. (c) complete binary tree is 2h.
The function returns 1 iff the binary tree is right- Q: INCORRECT.A binary search tree is may not be a
skewed BST. complete binary tree.

5. (c)
The function computes the total number of nodes in a
binary tree.

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE & IT Batch : Hinglish


Data Structure
Tree DPP 05

[NAT] [MSQ]
1. The minimum number of nodes in AVL tree of height 5. Consider the following operations in a BST-
6 is _______. INSERT(23), INSERT(17), INSERT(25), INSERT(4),
(Assume that the height of the root node is 1) INSERT(21), INSERT(1), INSERT(7), DELETE(17),
DELETE(23).
[MCQ] The post-order traversal of the resultant BST is-
2. Consider the following statements: (a) 1, 7, 4, 21, 25
P: An AVL tree is a height-balanced complete binary (b) 1, 4, 7, 25, 21
tree. (c) 1, 4, 21, 7, 25
Q: A heap is necessarily a complete binary tree. (d) None of the above
Which of the following statement(s) is/are
CORRECT? [MSQ]
(a) P only 6. Which of the following sequence(s) of array form a
(b) Q only heap?
(c) Both P and Q (a) 23, 17, 14, 6, 13, 10, 1, 12, 7, 5
(d) Neither P nor Q (b) 1, 5, 10, 6, 7, 12, 13, 14, 17, 23
(c) 23, 17, 14, 7, 13, 10, 1, 5, 6, 12
[NAT] (d) 1, 5, 10, 12, 13, 7, 14, 17, 23, 6
3. The total number of ways in which a max-heap can be
constructed with the keys-7, 6, 1, 4, 5, 2, 3 is ________. [NAT]
7. Consider the following statements:
[MCQ] P: The accepted balanced factor in an AVL tree are –1,
4. Consider the following statements: 0 and +1.
P: If the root node of a BST is deleted, it can be Q: The height of an AVL tree with n nodes is given as
replaced by inorder predecessor. log2n.
Q: If the root node of a BST is deleted, it can be The number of INCORRECT statements is ______.
replaced by preorder successor.
Which of the following is/are CORRECT? [NAT]
(a) P only 8. Construct an AVL tree with the following keys:
(b) Q only 12, 10, 15, 14, 13, 17, 8
(c) Both P and Q The immediate left child key value of the root node of
(d) Neither P nor Q the AVL tree is __________.
2

Answer Key
1. (20) 5. (a, b, c)
2. (b) 6. (b, c)
3. (80) 7. (0)
4. (a) 8. (12)
3

Hint & Solutions


1. (20)
The minimum number of nodes in an AVL tree of
height ‘h’ is given by-
n(h) = n(h – 1) + n(h – 2) + 1
n(1) = 1, n(2) = 2, n(3) = 4, n(4) = 7, n(5) = 12,
n(6) = 20

2. (b)
P: INCORRECT. An AVL tree is not necessarily a
complete binary tree.
Post order traversal: -
Q: CORRECT. A heap is necessarily a complete
binary tree. 1 7 4 21 25

3. (80)
T(n) = 1 * ( ) * T(k) * T(n – k – 1)
n –1
k

Here n = 7, k = 3
T(7) = 1 * ( 36 ) * T(3) * T(3)
Now, T(3) = 2
T(7) = 1 * ( 36 ) * 2 * 2 = 80 Post order traversal: -
1 4 7 25 21
4. (a)
If the root node of a BST is deleted, it can be replaced
by inorder predecessor/successor.

5. (a, b, c)

Post order traversal: -


1 4 21 7 25

6. (b, c)
(a)
4

Satisfies max-heap property.


(d)

Not possible defies min-heap property


Not possible defies max-heap property
(b)
7. (0)
Both the statements are CORRECT.

8. (12)
Resultant AVL tree:

Satisfies min-heap property


(c)

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE/IT Batch : Hinglish


Data Structure
Tree DPP-06

[NAT] 5. Consider a sequence of elements are inserted into a


1. The maximum number of comparisons to find the max-heap one after another as-
maximum element in a min heap of 1024 elements is 50, 40, 10, 5, 60, 70, 40, 15, 80
____________ The number of shift operations required in building
the heap one element at a time is _____________.
[MCQ]
2. Consider the array given below: [MCQ]
50 40 10 5 60 70 40 15 80 6. Consider a sequence of elements are inserted into a
max-heap one after another as-
The minimum number of comparisons required to
50, 40, 10, 5, 60, 70, 40, 15, 80
convert the above array into max heap is _______
The resultant max-heap using bottom-up approach of
build heap is-
[NAT] (a) 80, 60, 70, 40, 50, 10, 40, 15, 5
3. Consider the array given below:
(b) 80, 70, 60, 50, 40, 10, 40, 5, 15
50 40 10 5 60 70 40 15 80 (c) 80, 70, 60, 50, 40, 40, 15, 10, 5
The minimum number of swap operations required to (d) None of the above
convert the above array into max-heap is ________.
[MCQ]
[MCQ] 7. Consider the following two statements:
4. Consider the array given below: P: The number of comparisons required to find the
50 40 10 5 60 70 40 15 80 minimum element in a min heap of n elements is
n-1.
The resultant max-heap using bottom-up approach of Q: Only one comparison is required to find the
build heap is-
(a) 80, 60, 70, 40, 50, 10, 40, 15, 5 minimum element in a max heap of n elements.
(b) 80, 70, 60, 50, 40, 10, 40, 5, 15 Which of the following is/are CORRECT?
(c) 80, 70, 60, 50, 40, 40, 15, 10, 5 (a) P only
(d) None of the above (b) Q only
(c) Both P and Q
[NAT] (d) Neither P nor Q
2

Answer Key
1. (511) 5. (8)
2. (10) 6. (b)
3. (5) 7. (d)
4. (a)
3

Hints and Solutions

1. (511)
The maximum element will be present in the leaf
nodes.
Number of leaf nodes in the min-heap of 1024 elements
= 1024/2 = 512
Maximum number of comparisons to find the
maximum element in a min heap of 1024 elements =
512 – 1 = 511. 3. (5)

2. (10)
4

4. (a)

6. (b)
The resultant max-heap is-
80, 70, 60, 50, 40, 10, 40, 5, 15

7. (d)
P: INCORRECT. The number of comparisons
required to find the minimum element in a min
heap of n elements is 1.
Q: INCORRECT. Only one comparison is not
sufficient to find the minimum element in a max
heap of n elements.
5. (8)
5

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4


1

Branch : CSE/IT Batch : Hinglish


Data Structure
Tree DPP-07

[MCQ]
1. Which of the following is/are correct inorder traversal
sequence(s) of binary search tree(s)?
I. 3, 5, 7, 8, 15, 19, 25
II. 5, 8, 9, 12, 10, 15, 25
III. 2, 7, 10, 8, 14, 16, 20
IV. 4, 6, 7, 9 18, 20, 25
(a) I and IV (b) II and III
(c) II and IV (d) II only

[MCQ]
2. What is the worst-case time complexity of inserting n2 [MCQ]
elements into an AVL-tree with n elements initially? 6. A Binary Search Tree (BST) stores values in the range
(a) O(n2) (b) O(n2logn) 37 to 573. Consider the following sequence of keys.
4
(c) O(n ) (d) O(n3)
I. 81, 537, 102, 439, 285, 376, 305
II. 52, 97, 121, 195, 242, 381, 472
[MCQ] III. 142, 248, 520, 386, 345, 270, 307
3. Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are IV. 550, 149, 507, 395, 463, 402, 270
inserted in that order into an initially empty binary
Suppose the BST has been unsuccessfully searched for
search tree. The binary search tree uses the usual
ordering on natural numbers. What is the pre-order key 273. Which all of the above sequences list nodes
traversal sequence of the resultant tree? in the order in which we could have encountered them
(a) 7 5 1 0 3 2 4 6 8 9 in the search?
(b) 0 2 4 3 1 6 5 9 8 7 (a) I and III (b) II and III
(c) 0 1 2 3 4 5 6 7 8 9 (c) III and IV (d) III only
(d) 9 8 6 4 2 3 0 1 5 7
[NAT]
[MCQ] 7. A complete n-ary tree is a tree in which each node has
4. Consider the following statements.
n children or no children. Let I be the number of
S1: The sequence of procedure calls corresponds to a
preorder traversal of the activation tree. internal nodes and L be the number of leaves in a
S2: The sequence of procedure returns corresponds to complete n-ary tree. If L = 41, and I = 10, what is the
a postorder traversal of the activation tree. value of n? _____________.
Which one of the following options is correct?
(a) S1 only (b) S2 only [MCQ]
(c) Both S1 and S2 (d) Neither S1 nor S2 8. A Priority-Queue is implemented as a Max-Heap.
Initially, it has 5 elements. The level-order traversal of
[NAT] the heap is given below: 10, 8, 5, 3, 2. Two new
5. Consider the expression tree shown. Each leaf elements ‘1’ and ‘7’ are inserted in the heap in that
represents a numerical value, which can either be 0 or
order. The level-order traversal of the heap after the
1. Over all possible choices of the values at the leaves,
the maximum possible value of the expression insertion of the elements is:
represented by the tree is ___. (a) 10, 8, 7, 3, 2, 1, 5
(b) 10, 8, 7, 2, 3, 1, 5
(c) 10, 8, 7, 3, 2, 5, 1
(d) None of the above
3

Answer Key
1. (a) 6. (d)
2. (b) 7. (5)
3. (a) 8. (a)
4. (c)
5. (6)
4

Hints and Solutions

1. (a) 6. (d)
The inorder traversal of BST is always in sorted order.
2. (b)
The worst-case time complexity of inserting n2
elements into an AVL-tree with n elements initially is
O(n2logn)

3. (a)

Preorder traversal
7510324689

4. (c)
Both S1 and S2 are CORRECT.

5. (6)
5

8. (a)
7. (5)
L = (N –1) * I + 1
L = 41, I = 10 –
41 = (N –1) * 10 + 1
40
N –1 = =4
10
N=4+1=5

Level order Traversal:


10 8 7 3 2 1 5

Any issue with DPP, please report by clicking here:- https://forms.gle/t2SzQVvQcs638c4r5


For more questions, kindly visit the library section: Link for web: https://smart.link/sdfez8ejd80if

PW Mobile APP: https://smart.link/7wwosivoicgd4

You might also like