[SOLVED] CPD Exercise # 3

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon EX3-b9c73r.zip (769.6 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

In this exercise, we will write a program together! This program shows how to find the person A from the person B. For example, Bella has two friends, Jon and Kelly. Jon doesn’t know Kelly and Kelly doesn’t know Jon either, but we still can find Kelly from Jon since he could reach out Kelly through Bella (Jon Bella Kelly).

We provide all source files of this program on eCourse2. Your task is trying to understand all source files and write corresponding header files. Please see the table below for the content of each source file. Notice: Do not modify any file which we provide, if you do so, you will get zero point for this exercise.

File Name Content / Corresponding header file
main . c The main procedure of this program.

No corresponding header file. Yet, there’s one macro ” print ( ) ” you have to write, and you need to decide which header file is suitable for it.

my 10 . c Deal with the major inputs and outputs of this program, and check whether the arguments are correct.

Corresponding header file: “my 10 . h”.

myDS . c Implement stack and circular queue by using arrays. Corresponding header file: “myDS . h”.
myAIgo . c Provide DFS algorithm and BFS algorithm and initialization before algorithm.

Corresponding header file: “myAlgo . h”.

We won’t use DOMjudge as a checker because once this program can be compiled by entering “gcc main . c my 10. c myDS . c myAIgo . c” in the command line without warnings, the program’s output should be correct, because we write most of the 10 part. The table below shows how to execute this program and example input and output, in case you write the “_print()” part incorrectly.

 

Command Line Input Output
. / a. out DES BFS Build map

Enter a person (—1 for stop) : 1

Enter the number of person’s friend count: 2 Enter friends separated by space: 2 3 Enter a person •

Enter query: 2 3

Enter query: 1 4

DES :

BFS: DES : BFS :

Stranger !

Stranger !

. / a. out BFS Build map

Enter a person (—1 for stop) : 1

Enter the number of person’s friend count: 1 Enter friends separated by space: 2 Enter a person

Enter query: 1 2

BFS : 1
. / a. out BFS DES Build map

Enter a person (—1 for stop)   1

Enter the number of person’s friend count: 2 Enter friends separated by space: 2 3 Enter a person: 2 Enter the number of person’s friend count: 2 Enter friends separated by space: 3 4 Enter a person: 3 Enter the number of person’s friend count: 1 Enter friends separated by space: 4 Enter a person

Enter query: 1 4

BFS: 1

DES : 1

 

. / a . out DES BFS BFS no input too many arguments ! usage: a. out algorithm 1

[algorithm2]

 

  • EX3-b9c73r.zip