Week 01 - 01 Data Structures in AI Flashcards

(29 cards)

1
Q

What is a data structure?

A

A specialized format for a collection of data values, their relationships, and operations.

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

What is a tree data structure?

A

A hierarchical model organizing data with a root and child nodes in a branching structure.

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

What is the root of a tree?

A

The topmost node with no parent, origin of the tree.

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

What is a node in a tree?

A

An element storing data with links to children nodes.

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

What is an edge in a tree?

A

A link connecting a parent node to a child node.

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

What is a subtree?

A

A node and all its descendants in a tree.

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

What is a leaf node?

A

A node without any children.

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

How is the height of a tree defined?

A

The length of the longest path from the root to any leaf.

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

How is the depth of a node defined?

A

The number of edges from the root to that node.

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

What defines a full binary tree?

A

Every node has 0 or 2 children.

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

What defines a complete binary tree?

A

All levels fully filled except possibly last, filled left to right.

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

What is a degenerate binary tree?

A

Each parent has only one child, forming a linked-list-like structure.

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

What is a perfect binary tree?

A

A binary tree that is both full and complete; all leaves at same level.

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

What is a balanced binary tree?

A

A tree where left and right subtree heights differ by no more than one.

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

What is a binary search tree (BST)?

A

A binary tree where left subtree nodes are less than the node and right are greater.

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

What is a B-tree?

A

A self-balancing tree generalized to nodes with more than two children.

17
Q

What is a trie?

A

A prefix tree used for storing associative data, especially strings, for efficient prefix search.

18
Q

What is pre-order traversal?

A

Visit root, then left subtree, then right subtree.

19
Q

What is in-order traversal?

A

Visit left subtree, then root, then right subtree.

20
Q

What is post-order traversal?

A

Visit left subtree, then right subtree, then root.

21
Q

What is level-order traversal?

A

Visit nodes level by level from root to leaves (breadth-first).

22
Q

What is a graph?

A

A set of vertices connected by edges representing relationships.

23
Q

What is the difference between directed and undirected graphs?

A

Directed graphs have oriented edges; undirected graphs have bidirectional edges.

24
Q

What is a weighted graph?

A

A graph where edges have associated weights like cost or distance.

25
What is a sparse graph?
A graph with significantly fewer edges than the maximum possible.
26
What is a cyclic graph?
A graph containing at least one cycle where you can return to the starting node.
27
What is the difference between graphs and trees?
Trees are acyclic, hierarchical with a single root and one path between nodes; graphs are more general.
28
What is a stack?
A LIFO linear data structure with push/pop operations on the top.
29
What is a queue?
A FIFO linear data structure with enqueue at rear and dequeue at front.