Data Structures Flashcards
Tree: What is a height of a node?
It is the number of edges on the longest path between that node and a leaf node
Tree: What is a height of a tree?
It is the number of edges on the longest path between the root and a leaf node
Tree: What is a depth of a node?
It is the number of edges on the longest path between that node and the root
Tree: What is a node’s level?
It is defined as by 1 + depth of that node
Hashtable: What is a hash table?
It is a data structure which holds collection of key-value pairs and which operations of Insertion, Deletion and Lookup takes O(1) time
Tree: What number of levels a binary tree should have to hold N elements?
Levels = ceiling(log(N+1))
Tree: What is height-balanced binary tree?
A non-empty binary tree T is balanced if:
- Left subtree of T is balanced
- Right subtree of T is balanced
- The difference between heights of left subtree and right subtree is not more than 1.
Note: An empty tree is height-balanced
Tree: What is a full binary tree?
It is a tree in which every node other than the leaves has two children.
Tree: What is a complete binary tree?
It is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.
Graph: What is a strongly connected component (SCC) of a graph?
SCC is a subgraph in which any two vertices are connected to each other by a paths.
Graph: What is a strongly connected graph?
Graph is called strongly connected iff it has only one SCC.
Graph: What is a bridge of a graph?
The bridge or cut edge of a graph is any edge in a graph whose removal increases number of connected components.
Graph: What is an articulation point of a graph?
The articulation point of a graph is any node in a graph whose removal increases number of connected components.
Graph: What is a bipartite graph?
A bipartite graph is one whose vertices can be split into two independent groups U, V such that every edge connects between U and V.
Other definitions:
- The graph is two colorable
- The graph with no odd length cycles
Graph: What is a complete graph?
A complete graph is one where there is a unique edge between every pair of nodes.