The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
53 views

Which of the following procedure results same output as Dijkstra’s Algo. on unweighted graph on $'n'$ verices?

$A)$ BFS  $B)$ DFS   $C)$Kruskal  $D)$ Prims


As far I know Dijkstra and Prims both have $T.C.=O(E+VlogV)$

But ans given BFS.

How this ans possible??

in Algorithms by Veteran (113k points) | 53 views
0
unweighted = take each distance ( edge weight ) = 1 unit.

now think how dijkstra's work and bfs work.. U will realize
0

@Shaik Masthan

What about Prims??

Dijkstra work on all direction like BFS.

right?? but why not Prims??

Unweighted means no edge weight, then why take each edge weight as 1??

0
I think only for unweighted graph we have to select BFS. dijkstra is for weighted graph

1 Answer

0 votes
BFS when apply on an unweighted graph , In the resultant BFS tree it can be seen that the shortest path to every vertex from root (or the start vertex) is figured out.

It is quite similar to dijsktra algorithm which is also single source shortest path.
by Active (1.2k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,839 questions
54,799 answers
189,490 comments
80,677 users