Ask Question

In the ADT graph, the method addEdge has efficiency

A. O (1)

B. O (n)

C. O (logn)

D. O (n2)

+4
Answers (1)
  1. 1 January, 15:51
    0
    B. O (n).

    Explanation:

    In an ADT graph the method addEdge uses an Array of list. So in the worst case and the worst will be when the list already has n elements in it.

    So to add an edge we have to iterate over the list upto nth element and then add the edge after that. So it has to travel over n elements.

    So we can say that the answer is O (n).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “In the ADT graph, the method addEdge has efficiency A. O (1) B. O (n) C. O (logn) D. O (n2) ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers