
Concept explainers
PLEASE USE C LANGUAGE
The objective is to be able to implement a graph data structure and graph traversals.
1. Make a code for a program that follows the details in the PROGRAM SPECIFICATION section.
2. Develop a program following the structured
The program specifications are as follows:
Write a program that performs depth first search/traversal and breadth first search/traversal on predefined graphs.
(see the attached pictures for predefined graphs)
The graph search program will have the following main menu:
Graph Traversal Program
[1] Perform DFS Traversal
[2] Perform BFS Traversal
[3] Search Item using DFS
[4] Search Item using BFS
[0] Exit
Enter choice:
Details of the menu items are as follows:
Perform DFS Traversal
Once selected, the user is asked which graph to traverse. The program then performs depth-first search traversal and prints out the nodes in the order they are visited.
Perform BFS Traversal
Once selected, the user is asked which graph to traverse. The program then performs breadth first traversal and prints out the nodes in the order they are visited.
Search Item using DFS
Once selected, the user is asked what node to search and in which graph to search. The program then performs depth first search to search the node in the graph and prints a message stating if the node is part or not part of the graph.
Search Item using BFS
Once selected, the user is asked what node to search and in which graph to search. The program then performs breadth first search to search the node in the graph and prints a message stating if the node is part or not part of the graph.
Exit
Once selected, the program should terminate with a message informing the user that the program has ended.
Note: At the end of each process, the program should display a message appropriate to the result of the process. After processing the selected main menu item, the program should loop back to the main menu. The program should end only when the user selects the main menu item Exit.


Step by stepSolved in 3 steps with 5 images

- C POGRAM The objective is to be able to implement sorting algorithms to sort a sequence of numbers. 1. Make a code for a program that follows the details in the PROGRAM SPECIFICATION section.2. Develop a program following the structured programming approach at the very least. No global variable declarations are allowed. PROGRAM SPECIFICATION Write a program that implements three specified sorting algorithms and use each to sort an array of numbers. The sorting algorithms you are to implement are: SELECTION, MERGE, and RADIX. Your program should have the following main menu: Sorting Demonstration [1] Input array [2] Display array [3] Perform SELECTION SORT [4] Perform MERGE SORT [5] Perform RADIX SORT [0] Exit Enter choice: Details of the menu items are as follows: Input array: Once selected, the user is asked for the size of the array and the numbers to be stored to the array. Note: you are to implement a dynamic array to accommodate varying array sizes. Display array: Once…arrow_forwardProblem B Musical Key ConversionThe chromatic scale is a 12-note scale in music in which all notes are evenly spaced: that is, the ratio of the frequency between any two consecutive notes is constant. The notes are typically labeled in the following sequence: A, A#, B, C, C#, D, D#, E, F, F#, G, G# After G#, the labels loop back and start over with A (one octave higher). To convert between musical keys, you can shift all notes in a piece of music a constant number of steps along the scale above. For example, the sequence of notes E, E, F, G, G, F, E, D, C, C, D, E, E, D, D can be converted to another musical key by shifting everything up three steps: E, E, F, G, G, F, E, D, C, C, D, E, E, D, D G, G, G#, A#, A#, G#, G, F, D#, D#, F, G, G, F, F Notice that G was converted to A#, since going three steps up required us to loop off of the top of the scale back to the bottom: G -> G# -> A -> A#. Technically we should note that this would be A# of the next octave up, but we’ll…arrow_forwardLanguage is C++ Lab14A: The Architect. Buildings can be built in many ways. Usually, the architect of the building draws up maps and schematics of a building specifying the building’s characteristics such as how tall it is, how many stories it has etc. Then the actual building itself is built based on the schematics (also known as blueprints). Now it is safe to assume that the actual building is based off the blueprint but is not the blueprint itself and vice versa. The idea of a classes and objects follows a similar ideology. The class file can be considered the blueprint and the object is the building following the analogy mentioned above. The class file contains the details of the object i.e., the object’s attributes (variables) and behavior (methods). Please keep in mind that a class is a template of an eventual object. Although the class has variables, these variables lack an assigned value since each object will have a unique value for that variable. Think of a form that you…arrow_forward
- Topical Information Use C++. This lab will help you practice with dynamic memory (NOT mixed with classes). Program Information Heat flow through a rod can be simulated fairly easily in a computer program. We can simulate the rod using an array of temperatures. The rod begins all at the same temperature (user determined), but holding some position(s) of the rod at constant temperature (holding a match or ice cube to the rod) provides a [set of] heat source(s) (or sink(s)). To update the temperature at each time step (second?), you take the average of the positions on each side from the previous time step (and at the current position). For instance, if the following was the initial state of the rod: +------+------+------+------+------+------+------+------+ | 10 | 10 | 10 | 10 | 10 | 10 | 10 | 10 | +------+------+------+------+------+------+------+------+ And then the user specifies that there is a heat source at the left end of 100 degrees:…arrow_forwardZybooks C++ 1.7 LAB: Introduction to data structures labs Step 1: Producing correct output Three commented-out lines of code exist in main(). Uncomment the lines and click the "Run program" button. Verify that the program's output is: 2 + 2 = 4 Unknown function: PrintPlus2 Secret string: "abc" Submit your code for grading. Your submission will pass the "Compare output" test only, achieving 1 of the possible 10 points. Step 2: Inspecting the LabPrinter class Inspect the LabPrinter class implemented in the LabPrinter.h file. Access LabPrinter.h by clicking on the orange arrow next to main.cpp at the top of the coding window. Member functions Print2Plus2() and PrintSecret() print strings using std::cout. Step 3: Implementing CallFunctionNamed() Remove the three uncommented lines from main(). Then implement the CallFunctionNamed() function in main.cpp to handle three cases: If functionName is "Print2Plus2", call printer's Print2Plus2() member function. If functionName is "PrintSecret",…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





