diference between breadth fisrtsearct and depth first search

Reply

Join Date: Jul 2006
Posts: 67
Reputation: himanjim is an unknown quantity at this point 
Solved Threads: 1
himanjim himanjim is offline Offline
Junior Poster in Training

diference between breadth fisrtsearct and depth first search

 
0
  #1
Jun 17th, 2007
Hi,
I've just started data structures....I'm studying Breadth first search and depth first search algo....Though I got some idea about them but after spending hours I can't understand the exact difference between them
Which one is better ?? Please help me out
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 539
Reputation: thekashyap will become famous soon enough thekashyap will become famous soon enough 
Solved Threads: 50
thekashyap's Avatar
thekashyap thekashyap is offline Offline
Posting Pro

Re: diference between breadth fisrtsearct and depth first search

 
0
  #2
Jun 17th, 2007
Donno exactly what you wanna know abt the 2 methods but in simplest words when applies to a tree structure with say 3 levels:
BFS: Will test all nodes on one level before moving on to the next level.
DFS: will test all child nodes of the all levels belonging to one branch before back-tracking and repeating.

Don't I can explain better than wiki:
http://en.wikipedia.org/wiki/Breadth-first_search
http://en.wikipedia.org/wiki/Depth-first_search
Are you Agile.. ?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC