1.

How many times the insert and extract min operations are invoked per vertex?(a) 1(b) 2(c) 3(d) 0The question was posed to me at a job interview.Question is from Shortest Path topic in division Shortest Path of Data Structures & Algorithms II

Answer»

The correct choice is (a) 1

Easiest explanation - Insert and extract min operations are invoked only once per VERTEX because each vertex is added only once to the SET and each edge in the adjacency list is EXAMINED only once during the COURSE of algorithm.



Discussion

No Comment Found

Related InterviewSolutions