Week 01 - 01 Data Structures in AI Flashcards
(29 cards)
What is a data structure?
A specialized format for a collection of data values, their relationships, and operations.
What is a tree data structure?
A hierarchical model organizing data with a root and child nodes in a branching structure.
What is the root of a tree?
The topmost node with no parent, origin of the tree.
What is a node in a tree?
An element storing data with links to children nodes.
What is an edge in a tree?
A link connecting a parent node to a child node.
What is a subtree?
A node and all its descendants in a tree.
What is a leaf node?
A node without any children.
How is the height of a tree defined?
The length of the longest path from the root to any leaf.
How is the depth of a node defined?
The number of edges from the root to that node.
What defines a full binary tree?
Every node has 0 or 2 children.
What defines a complete binary tree?
All levels fully filled except possibly last, filled left to right.
What is a degenerate binary tree?
Each parent has only one child, forming a linked-list-like structure.
What is a perfect binary tree?
A binary tree that is both full and complete; all leaves at same level.
What is a balanced binary tree?
A tree where left and right subtree heights differ by no more than one.
What is a binary search tree (BST)?
A binary tree where left subtree nodes are less than the node and right are greater.
What is a B-tree?
A self-balancing tree generalized to nodes with more than two children.
What is a trie?
A prefix tree used for storing associative data, especially strings, for efficient prefix search.
What is pre-order traversal?
Visit root, then left subtree, then right subtree.
What is in-order traversal?
Visit left subtree, then root, then right subtree.
What is post-order traversal?
Visit left subtree, then right subtree, then root.
What is level-order traversal?
Visit nodes level by level from root to leaves (breadth-first).
What is a graph?
A set of vertices connected by edges representing relationships.
What is the difference between directed and undirected graphs?
Directed graphs have oriented edges; undirected graphs have bidirectional edges.
What is a weighted graph?
A graph where edges have associated weights like cost or distance.