DATA STRUCTURE: STACK Flashcards

1
Q

a linear data structure that follows the Last-In-First-Out (LIFO)
principle.

A

STACKS

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

the last element added to the stack
is the first one to be removed.
• Insertion and deletion allowed only

A

at one end (top)

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

STACKS OPERATION
 adding an element to the top of the stack

A

Push (insertion)

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

STACKS OPERATION
 removing the topmost element from the stack

A

Pop (deletion)

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

STACKS OPERATION
 viewing the topmost element without removing
it

A

Peek

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

 the stack is full and push operation is
attempted

A

Overflow state

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

 the stack is empty and we attempt the pop
operation

A

Underflow state

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

APPLICATIONS AND USE CASES OF STACKS
Stacks are used to evaluate arithmetic expressions, handle operator precedence, and perform infix-to-postfix
conversion.

A

Expression Evaluation

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

APPLICATIONS AND USE CASES OF STACKS
Stacks are used to implement undo functionality in text
editors, software applications, and interactive environments.

A

Undo Operations

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

APPLICATIONS AND USE CASES OF STACKS
Stacks are utilized in algorithms that require backtracking,
such as maze-solving and depth-first search.

A

Backtracking

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

APPLICATIONS AND USE CASES OF STACKS
Stacks play a role in memory management, particularly in managing activation records during program execution.

A

Memory Management

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

a linear data structure that follows the First-In-First-Out (FIFO) principle.

A

QUEUES

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

first element added is the first one to be
removed
• It represents a collection of elements in
which elements are added at one end
(rear) and removed from the other end
(front).

A

Queues

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

 adds an element to the rear (end) of the queue. The
newly added element becomes the last one in the
queue.

A

queues operations Enqueue (insertion)

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

 removes the element from the front of the queue. The
next element in the queue becomes the new front.

A

Dequeue (deletion)

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

 view the element at the front of the queue without
removing it.

A

Peek

17
Q

A non-linear data structure that consists of nodes
and is connected by edges with a hierarchical organization

A

TREES

18
Q

The nodes in a tree are arranged in a each node can have (zero or more
child nodes)

A

parent-child
relationship

19
Q

The topmost node in a tree is called the

A

root node

20
Q

TERMINOLOGY
Each element in a tree. It contains some data and
may have references to its child nodes. T, S, O, Q, etc. are the nodes of the tree.

A

Node

21
Q

Represents a connection between two nodes. It
defines the relationship between a parent node and its
child node. A line connecting the nodes.

A

Edge

22
Q

A node that has one or more child nodes. It is
located above its child nodes in the hierarchy.

A

Parent

23
Q

A node that has a parent node. It is located below
its parent node in the hierarchy. In a tree, every node except the root node is a child node

A

Child

24
Q

A node that does not have any child nodes. It is also known as a terminal node.

A

Leaf

25
Q

Nodes that have one or more child
nodes. They are neither leaf nodes nor the root node.

A

Internal Nodes

26
Q

the total number of children of a node. The
highest degree of the node among all the nodes in a tree
is called the Degree of Tree.

A

DEGREE

27
Q

the distance of a node from the root.

A

LEVEL

28
Q

the number of edges from the leaf node to the particular node in the longest path is known as the height of that node. In the tree, the height of the root node is called “Height of Tree”.

A

Height

29
Q

many edges from the root node to the particular
node are called the depth of the tree. In the tree, the total
number of edges from the root node to the leaf node in
the longest path is known as “Depth of Tree”.

A

Depth

30
Q

the sequence of nodes and edges from one node
to another node is called the path between those two
nodes. The length of a path is the total number of nodes
in a path

A

PATH

31
Q

TYPES OF TREES
• In a tree data structure, the root is the first node of the tree. The root node is the initial node of the tree in data structures.
• In the tree data structure, there must be only one root node.

A

Root Node

32
Q

A node can have any at most two children
• Follows all properties of the tree data structure.
• Binary trees can have at most two child nodes.
• These two children are called the left child and the right child.

A

BINARY TREES

33
Q

• Follows all properties of the tree data structure
Left node value<= root node <= right m
• The binary search tree has a unique property known as the binary search property. This states that the value of a left child node of the tree should be less than or equal to the parent node value of the tree. And the value of the right child node should be greater than or equal to the parent value.

A

BINARY SEARCH TREE

34
Q

• Follows all properties of the tree data structure.
• Self-balancing.
• Each node stores a value called a balanced factor, which is the difference in the height of the left sub-tree and right sub-tree.
• All the nodes in the AVL tree must have a balance factor of -1, 0, and 1.

A

AVL TREE: (Georgy Adelson-Velsky and Landis – inventor)

35
Q

is a special kind of self-balancing search tree in which each node can contain more than one key and can have more than two children.

A

B-TREE

36
Q

is also known as a height-balanced.

A

B tree/m-way tree.