answersLogoWhite

0

The algorithm for breadth first search is to start at the root node or at an arbitrary node within the tree. First, push this node onto a queue. Then proceed as follows

1. If the queue is empty, quit the search and return a "not found" result.

2. Pop the first node from the queue.

3. If this node contains the value you seek, quit the search and return the node.

4. Enumerate the child nodes (if any), and push them onto the queue.

5. Go to step 1.

User Avatar

Wiki User

10y ago

What else can I help you with?

Related Questions

How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


If you know the perimeter how do you find the area?

Perimeter equals to 2 times the length plus 2 times the breadth. Area equals to length multiply by breadth


What is a main function in c plus plus?

It is the first function that gets called when the program is executed.


Write a program in c plus plus to compute first of non-terminal?

there is no solution of this problem...........that's it..........


How to restart c plus plus program?

Exit the program and relaunch it.


Can you program games with c plus plus?

Yes, you can program games with C++.


Is there an answer book for the A plus program?

The A Plus Program is an initiative, not a test. So no, there is no answer book.


Rectangle....p equals 2b plus 2h?

Yes, provided p = perimeter, b= breadth and h = height.


Write a program in c plus plus for finding the sum of first 10 even numbers?

int i, sum = 0; for (i=0; i<20; i+=2) sum+=i;


How do you write a program in C plus plus to find volumn of a cuboid?

#include<iostream.h> void main() { int l,b,h,v; cout<<"Enter length "; cin>>l; cout<<"Enter breadth "; cin>>b; cout<<"Enter Height "; cin>>h; v=l*b*h; cout<<"Volume is "<<v; }


How do you write an Algorithm for a C plus plus Program?

You don't write an algorithm for a C++ program, unless you are documenting the C++ program after-the-fact. The normal procedure is to write the algorithm first, in a language independent fashion, and then translate that stated algorithm into C++ code, or into whatever language you wish.


Why does sometimes when you run a program it will execute the previous program instead the current open program in C plus plus?

Because you aren't careful enough.