Module 4 Flashcards

Examination

1
Q

STANDS AS A PIVOTAL NONLINEAR DATA STRUCTURE

IS EITHER EMPTY OR CONSISTS OF A ROOT NODE AND ZERO OR MORE SUBTREES.

A

Tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Type of Trees

A
  • ORDERED TREE
  • ORIENTED TREE
  • FREE TREE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

FINITE SET OF NODES WHERE ONE IS THE ROOT AND THE REST ARE PARTITIONED INTO ORDERED SUBTREES, PRESERVING THE SIGNIFICANCE OF NODE ORDER.

A

ORDERED TREE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

A TREE WHERE THE ORDER OF SUBTREES FOR EACH NODE DOESN’T HOLD SIGNIFICANCE.

A

ORIENTED TREE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

HAS NO NODE DESIGNATED AS THE ROOT AND THE ORIENTATION FROM A NODE TO ANY OTHER NODE IS INSIGNIFICANT.

A

FREE TREE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

A FREE TREE WITH A DESIGNATED ROOT TRANSFORMS INTO AN ORIENTED TREE

WHEN A FREE TREE IS DESIGNATED A ROOT NODE, IT BECOMES AN ORIENTED TREE. WHEN THE ORDER OF THE NODES ARE DEFINED IN AN ORIENTED TREE, IT BECOMES AN ORDERED TREE.

A

Tree Progression

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Types of Representations

A

Link Representations
Binary Representations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

o UTILIZES LINKS TO DEPICT TREE STRUCTURES, WHERE EACH NODE CONTAINS LINKS TO ITS POSSIBLE SONS.

A

Link Representations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

o AN ALTERNATIVE STRUCTURE, PRIMARILY FOR BINARY TREES, USING LEFT AND RIGHT POINTERS TO DESIGNATE THE LEFTMOST SON AND THE NEXT YOUNGER BROTHER

A

Binary Representations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
  • ASSEMBLING DISJOINT TREES FORMS A _______
  • WHEN ZERO OR MORE DISJOINT TREES ARE TAKEN TOGETHER, THEY ARE KNOWN AS A ______.
A

Forest

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q
  • A PROCESS CONVERTING AN ORDERED FOREST INTO A UNIQUE BINARY TREE AND VICE VERSA USING A SPECIFIC METHOD,
A

Natural Correspondence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A HIERARCHICAL DATA STRUCTURE CONSISTING OF NODES ORGANIZED IN A SPECIFIC ARRANGEMENT

A

Binary Tree Structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Binary Tree Structure KEY CHARACTERISTICS ARE

A

o NODES
o ROOTS NODES
o CHILD NODES
o LEAVES OR TERMINAL NODE
o INTERNAL NODE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

CONTAINS:
o DATA OR PAYLOAD.
o REFERENCES OR POINTERS TO AT MOST TWO CHILD NODES, TYPICALLY DENOTED AS THE LEFT CHILD AND THE RIGHT CHILD.
IN A BINARY TREE CAN HAVE ZERO, ONE, OR TWO CHILDREN.

A

Node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
  • THE TOPMOST NODE OF THE TREE.
  • IT SERVES AS THE STARTING POINT FOR ACCESSING ALL OTHER NODES IN THE TREE.
A

Root Node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  • EVERY NODE (EXCEPT THE LEAVES) HAS AT MOST TWO CHILDREN - A LEFT CHILD AND A RIGHT CHILD.
  • THESE ______ ARE CONNECTED DOWNWARDS FROM THEIR PARENT NODE.
A

Chilld Node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q
  • NODES WITHOUT ANY CHILDREN ARE TERMED AS _________.
A

LEAVES OR TERMINAL NODES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q
  • NODES THAT HAVE AT LEAST ONE CHILD ARE CONSIDERED _________.
A

INTERNAL NODES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Node Relationships in a Binary Tree

A

Root Node
Parent and Children Nodes
Leaves or Terminal Nodes
Internal Nodes
Siblings
Ancestors and Descendants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q
  • THE TOPMOST NODE IN THE BINARY TREE.
  • DOES NOT HAVE A PARENT NODE AND SERVES AS THE STARTING POINT FOR TRAVERSING THE TREE.
A

Root Node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q
  • EACH NODE (EXCEPT THE ROOT) HAS A PARENT NODE.
  • NODES MAY HAVE AT MOST TWO CHILDREN, KNOWN AS THE LEFT CHILD AND THE RIGHT CHILD.
A

Parent and Children Nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q
  • NODES WITHOUT CHILDREN ARE THE __________.
  • THEY DO NOT HAVE ANY FURTHER DESCENDANTS.
A

Leaves or Terminal Node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q
  • NODES WITH AT LEAST ONE CHILD ARE _______.
  • THEY SERVE AS INTERMEDIARIES BETWEEN THE ROOT AND THE LEAVES.
A

Internal Nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q
  • NODES THAT SHARE THE SAME PARENT ARE CALLED __________.
  • THEY ARE ON THE SAME LEVEL OF THE TREE AND HAVE THE SAME PARENT NODE.
A

Siblings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q
  • _________ OF A NODE ARE ALL THE NODES PRESENT ON THE PATH FROM THE ROOT TO THAT PARTICULAR NODE.
  • ____________ OF A NODE ARE ALL THE NODES REACHABLE FROM THAT NODE, INCLUDING ITS CHILDREN, GRANDCHILDREN, AND SO FORTH.
A

Ancestors and Descendants

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

Types of Binary Trees

A

Skewed Binary Tree

Strict Binary Tree

Full Binary Tree

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

o EVERY NODE HAS NO LEFT (RIGHT) SUBTREE, CREATING A LINEAR STRUCTURE.

A

Skewed Binary Tree

28
Q
  • EACH NODE EITHER HAS TWO CHILDREN OR NONE AT ALL
A

Strict Binary Tree

29
Q
  • EVERY INTERNAL NODE HAS EXACTLY TWO CHILDREN.
A

Full Binary Tree

30
Q

Complete Binary Tree
* CONSTRUCTED BY SYSTEMATICALLY DELETING NODES FROM A FULL BINARY TREE IN A SPECIFIC ORDER (RIGHT TO LEFT, BOTTOM TO TOP).

A

Complete Binary Tree

31
Q

Properties of Binary Trees

A

Level and Height

Internal and External Nodes

Number of Nodes

Terminal Nodes

32
Q

o NODES’ DISTANCE FROM THE ROOT. THE ROOT IS AT LEVEL 0, AND EACH LEVEL MOVES FURTHER AWAY FROM THE ROOT.

33
Q

o THE LENGTH OF THE LONGEST ROOT-TO-LEAF PATH. IT SIGNIFIES THE MAXIMUM DEPTH OF THE TREE.

34
Q

o NODES WITH AT LEAST ONE CHILD.

A

Internal Node

35
Q

o NODES WITHOUT CHILDREN, ALSO KNOWS AS TERMINAL OR LEAF NODES.

A

External Node

36
Q
  • THE MAXIMUM NUMBER OF NODES FOR A DEPTH OF K IS 2^K - 1, AND THE MINIMUM NUMBER IS 2^K+1 – 1.
A

Number of nodes

37
Q
  • THE COUNT OF ______ (N0) OR LEAVES IN RELATION TO NODES WITH DEGREE 2 (N2) IS GIVEN BY N0 = N2 + 1.
  • THIS RELATION HOLDS IN ANY BINARY TREE, WHERE THE NUMBER OF LEAVES IS ONE MORE THAN THE NUMBER OF NODES WITH EXACTLY TWO CHILDREN.
A

Terminal Nodes

38
Q
  • IS THE PROCESS OF VISITING AND PROCESSING EACH NODE IN A BINARY TREE IN A SYSTEMATIC ORDER.
A

Binary Tree Traversal

39
Q

(Root -> Left -> Right)

A

Pre-Order Traversal

40
Q

(Left -> Root -> Right)

A

In-Order Traversal

41
Q

( Left -> Right -> Root).

A

Post-Order Traversal

42
Q

Advance Concepts and Variants

A

Self-Balancing Binary Tree
Binary Heaps

43
Q
  • Red-Black Trees, AVL Trees

o TREES THAT AUTOMATICALLY BALANCE THEMSELVES, ENSURING OPTIMAL PERFORMANCE FOR OPERATIONS LIKE INSERTION, DELETION, AND SEARCH.

A

Self-Balancing Binary Tree

44
Q
  • Mini-Heap, Max-Heaps

o SPECIALIZED BINARY TREES USED FOR PRIORITY QUEUES, ENSURING EFFICIENT ACCESS TO HE MINIMUM OR MAXIMUM ELEMENT.

A

Binary Heaps

45
Q
  • IS A FUNDAMENTAL DATA STRUCTURE IN COMPUTER SCIENCE THAT ORGANIZES NODES IN A HIERARCHICAL STRUCTURE.
A

Binary Search Trees

46
Q

Operation on Binary Search Trees

A

Searching
Insertion
Deletion

47
Q
  • THE SEARCH OPERATION IN A BST (BINARY SEARCH TREE) INVOLVES COMPARING THE VALUE TO BE FOUND WITH THE VALUE AT THE CURRENT NODE
48
Q
  • WHEN INSERTING A NEW NODE INTO A BST
  • START WITH A SEARCH TO FIND THE APPROPRIATE LOCATION FOR THE NEW NODE.
  • IF THE SEARCH REACHES A NULL POSITION, INSERT THE NEW NODE WITH THE VALUE ‘K’ AT THAT POSITION ACCORDING TO THE BST PROPERTY.
49
Q
  • DELETING A NODE IN A BST REQUIRES CAREFUL HANDLING TO MAINTAIN THE TREE’S BST PROPERTY:
  • IF THE NODE TO BE DELETED IS A LEAF NODE (NO CHILDREN), SIMPLY REMOVE IT BY UPDATING ITS PARENT’S POINTER.
  • IF THE NODE HAS ONLY ONE CHILD, REPLACE THE NODE TO BE DELETED WITH ITS CHILD.
  • IF THE NODE HAS TWO CHILDREN:
  • FIND EITHER ITS IN-ORDER PREDECESSOR OR SUCCESSOR.
  • REPLACE THE NODE TO BE DELETED WITH THE PREDECESSOR OR SUCCESSOR.
  • ADJUST THE POINTERS TO MAINTAIN THE BST PROPERTY.
50
Q
  • HAPPENS WHEN THE TREE IS BALANCED.
A
  • AVERAGE CASE: O(LOG₂ N)
51
Q

OCCURS WHEN THE TREE IS DEGENERATE (SKEWED, ALL NODES TO ONE SIDE).

A
  • WORST CASE: O(N)
52
Q
  • SIMILAR TO SEARCH, THESE OPERATIONS HAVE O(LOG₂ N) TIME COMPLEXITY ON AVERAGE BUT CAN DETERIORATE TO O(N) IN A DEGENERATE TREE.
A

Insertion and Deletion

53
Q
  • MAINTAIN O(LOG₂ N) TIME FOR SEARCH, INSERTION, AND DELETION.
A

BALANCED BSTS

54
Q
  • PERFORM SIMILAR TO A LINKED LIST WITH O(N) TIME COMPLEXITY FOR SEARCH, MAKING THEM LESS EFFICIENT.
A

UNBALANCED (DEGENERATE) BSTS

55
Q
  • ARE A FUNDAMENTAL TYPE OF SELF-BALANCING BINARY SEARCH TREE NAMED AFTER THEIR INVENTORS, ADELSON-VELSKY AND LANDIS.
56
Q

Characteristics of AVL Trees

A

Balance Factor
Balancing Conditions

57
Q
  • EACH NODE IN AN AVL TREE HAS A BALANCE FACTOR, WHICH IS THE DIFFERENCE IN HEIGHT BETWEEN THE LEFT AND RIGHT SUBTREES.
A

Balance Factor

58
Q
  • FOR ANY NODE IN THE AVL TREE, THE HEIGHT DIFFERENCE (BALANCE FACTOR) BETWEEN ITS LEFT AND RIGHT SUBTREES SHOULD NOT EXCEED 1.
  • THIS CONDITION HOLDS TRUE FOR EVERY NODE IN THE TREE.
A

Balancing Conditions

59
Q

Operations in AVL Trees

A

Insertion
Deletion

60
Q
  • WHEN A NEW NODE IS INSERTED INTO AN AVL TREE, THE TREE MIGHT BECOME UNBALANCED.
  • AFTER INSERTION, THE BALANCE FACTORS OF NODES ALONG THE INSERTION PATH ARE UPDATED.
  • IF THE BALANCE CONDITION IS VIOLATED, ROTATIONS (SINGLE OR DOUBLE) ARE PERFORMED TO RESTORE BALANCE WHILE MAINTAINING THE ORDERING PROPERTY OF THE BST.
61
Q
  • DELETING A NODE MAY ALSO LEAD TO AN IMBALANCE IN THE AVL TREE.
  • SIMILAR TO INSERTION, AFTER DELETION, THE BALANCE FACTORS OF AFFECTED NODES ARE UPDATED.
  • IF NECESSARY, ROTATIONS ARE PERFORMED TO RESTORE BALANCE.
62
Q

Rotations In AVL Trees

A

Single Rotations
Double Rotations

63
Q
  • LEFT ROTATION:
  • RIGHT ROTATION:
A

Single Rotations

64
Q
  • LEFT-RIGHT ROTATION
  • RIGHT-LEFT ROTATION
A

Double Rotations