Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help in C + + , problem and instructions are in the photo, here are a few requirements :These are the member variables of

Please help in C++, problem and instructions are in the photo, here are a few requirements :These are the member variables of the Graph class that you will need to use in your implementation:
std::list **graph
This is an array of pointers, where each pointer points to an STL list of type int.
Each STL list stores the adjacent vertices to the vertex that corresponds to the index of the array.
For example, at index 3 of the array, the list to which the pointer at index 3 is pointing stores all the adjacent vertices to vertex 3.
int numOfVertices
The variable numOfVertices stores the number of vertices in the graph.
The capacity of the graph is irrelevant in your implementation, because the graph has already been built.
I recommend you draw the array with all pointers and all the lists showing the adjacent vertices.
Parameter: An empty array that is already set to have capacity equal to the number of vertices in the graph. The parameter array must be named bfsData.
The function must behave as shown on the lesson slides. The final BFS must be stored in the parameter array bfsData, which will be printed outside the function; this means that there is NO printing done in this function.
Note that if implemented properly, this function will be no longer than 25 complete statements (this does not include empty lines or brackets). If it is longer than that, make sure you revisit your implementation to clean it up.
Requirements:
Parameter identifier: bfsData
The un/visited sequence must be represented by a dynamic array of type Boolean.
To create the queue use the custom class Queue (this is NOT the STL queue class). It includes all the necessary functions (default constructor, push, pop, empty, front), but it is not a template class.
The implementation must strictly follow the traversal shown on the slide (other implementations will not be accepted).
The implementation must be efficient, and in particular, it must control the loops to avoid looping unnecessarily (as explained on the slides).
You may not create containers other than the ones mentioned above.
This means that your implementation will work with 3 containers only: the dynamic array (un/visited sequence), the queue, and the parameter array to store the BFS.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

=+what information would you need about the compact disc industry?

Answered: 1 week ago