DSA Unit 3, 4, 5 Flashcards

1
Q

Define spanning tree

A

subset of graph G where vertices connected using minimum possible number of edges

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

Justification of Array|Linked

A

Space efficiency (array could have many unused indices)
Dynamic size (adding or removing nodes frequently)
Traversal flexibility (without worrying about structure of array )

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

Advantages and disadvantages of TBT

A

Efficient traversal
Space utilization
No stack Overhead
Faster Access

complex implementation
increased memory usage for every node

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

Applications of MST

A

Image processing
Network design
Game development
Electric circuit

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

Define Stack

A

Linear abstract data structure
LIFO principle

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

Types of stack

A

Implicit - not implemented by user
Explicit - user implemented

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

Stack Operations

A

Push
Pop
Peek
isFull
isEmpty
display

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

Define Queue

A

Linear abstract data structure
FIFO principle

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

Types of Queue

A

Simple
Circular
Priority Queue (Ascending and Descending)

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

Define Graph

A

Non Linear Data structure using vertices (fundamental units) and edges (connections)

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

Operations on Graph

A

Insert, Delete, Search, and Traverse

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

Graph traversal methods

A

BFS (2 queues: Neighbour and Visited)
DFS (adjacent visits)

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

Kruskal and Prim time complexity

A

O( |E|log|E| )

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

Greedy Algorithm

A

paradigm that builds a solution by choosing pieces with greed (immediate benefit)

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

Define Tree

A

Tree is a hierarchical data sturcture where data arranged in multiple levels

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

Height and Depth

A

Depth - Root to node distance
Height - (Longest) Node to Lead distance

17
Q

Types of Binary Tree

A

Full (0 or 2 children)
Degenerate (1 child)
Skewed (only lefts or rights)
Complete (all levels filled except last)
Perfect (leaves at same level)

18
Q

Sequential Tree

A

Minimum information required to reconstruct a tree (no pointers)

19
Q

Tree traversal methods

A

Pre order - root - left - right
In order - left - root - right
Post order - left - right - root
BFS - level wise

20
Q

Huffmann Tree

A

according to frequency of nodes (highest - up, lowest - down)

21
Q

Threaded binary tree

A

Empty child nodes replaced with threads

22
Q

What is ADT

A

An ADT defines the interface or the contract of a data structure, specifying what operations can be performed on it, without specifying how those operations are implemented.

23
Q

Applications of Stack

A

Infix to Postfix/Prefix conversions
Reverse a string
Decimal to Binary conversions
Simulate recursion

24
Q

What is AVL and its time complexity?

A

AVL (Adelson Velsky and Landis)
self balancing binary tree which balances every time insertion or deletion occurs.
Time complexity : O(log n)

25
Q

Time complexity for heap sort

A

O(n log n)
Heap creation O(n)
Heapify O(nlogn)

26
Q

Time complexity for deleting a record from index sequential file

A

Best-case time complexity: O(log n) when the index is highly efficient and the record is located near the beginning of the file.
Average-case time complexity: O(n) due to the sequential search and shifting of records.
Worst-case time complexity: O(n) when the record is located at the end of the file and all records need to be shifted.