Data Structures & Algorithms in Python: Trees & Graphs
What is the time complexity of binary search?
O(log n)
Which of the following statements about binary search trees are TRUE?
The worst case time complexity of a lookup is O(n) The structure depends on the order in which nodes are inserted
Which of the following statements about breadth first traversal on a binary search tree are TRUE?
All nodes at one level are visited before any node lower in the tree The root node is the first to be visited
Where in the binary search tree can its minimum value be found?
At the left-most node
Which of these binary tree traversals generates an ascending order of the values in its nodes?
In-order
Which options represent properties that a graph must fulfil to be eligible for a topological sort?
It cannot contain any cycles It should be a directed graph
What is the complexity of the operation to look up whether an edge is present between two vertices in a graph when it is represented as an adjacency matrix?
O(1)
Which of the following statements about graphs are TRUE?
The edges connecting vertices can be directed or undirected Two vertices connected by an edge represent a graph
What is the last node to be visited in a post-order traversal of a binary search tree?
The root of the tree
What term is used to denote the nodes of a tree which do not contain any children?
leaf
Given a graph with n vertices, what is the number of cells in its adjacency matrix?
n^2
