Data Structures & AlgorithmsEasyWipro · Accenture pattern
How many edges does a complete undirected simple graph on 10 vertices have?
- A. 45
- B. 100
- C. 90
- D. 55
Correct answer: A. 45
Every pair of vertices is joined once: C(10, 2) = 10 × 9/2 = 45. 90 counts each edge twice (as in a directed complete graph).
Practise more Trees, Graphs, Recursion and Dynamic Programming questionsTrees, Graphs, Recursion and Dynamic Programming: notes and key points
More Trees, Graphs, Recursion and Dynamic Programming questions
- What is the time to search for a word of length L in a trie that holds n words?
- An undirected graph has 12 vertices and the sum of the degrees of all vertices is 40. How many edges does it have?
- The preorder traversal of a BST is 8, 5, 1, 7, 10, 12. What is its postorder traversal?
- A binary tree has inorder 4 8 2 5 1 6 3 7 and preorder 1 2 4 8 5 3 6 7. What is its postorder?
- 10, 4, 7, 1, 3 are inserted in that order into an empty binary min-heap (array form, sift-up after each insert). What is the array at the…
- The bottom-up build-heap procedure (sift down from the last internal node back to the root) turns [3, 1, 6, 5, 2, 4] into a max-heap. What…