Solved

DFS & BFS

Posted on 2002-04-30
4
1,829 Views
Last Modified: 2011-10-03
I need programs for depth first search and breadth first search (of graph) implemented in 'C' language.
should be runable code(main(){}).
0
Comment
Question by:bhombal
  • 2
4 Comments
 
LVL 6

Expert Comment

by:snoegler
Comment Utility
Search what? Files? B-Trees? etc.?
0
 
LVL 6

Accepted Solution

by:
snoegler earned 50 total points
Comment Utility
The concept of depth-first:

void DF_search(what)
{
  for(each child in what;;child++)
  {
    if(child->hasChilds()) search(child);
  }

  for(each child in what;;child++)
  {
    if(!child->hasChilds()) doSomething();
  }
}

Vice versa, breadth first:
void BF_search(what)
{
  for(each child in what;;child++)
  {
    if(!child->hasChilds()) doSomething();
  }

  for(each child in what;;child++)
  {
    if(child->hasChilds()) search(child);
  }
}
0
 
LVL 11

Expert Comment

by:griessh
Comment Utility
Dear bhombal

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. You can always request to keep this question open. But remember, experts can only help you if you provide feedback to their questions.
Unless there is objection or further activity,  I will suggest to accept

     "snoegler"

comment(s) as an answer.

If you think your question was not answered at all, you can explain here why you want to do this and post a request in Community support (please include this link) to refund your points. The link to the Community Support area is: http://www.experts-exchange.com/commspt/


PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 6

Expert Comment

by:Mindphaser
Comment Utility
Force accepted

** Mindphaser - Community Support Moderator **
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now