Question

Submission Question: Recursion with Trees – Depth First Search & Breadth First Search Write a Python...

Submission Question: Recursion with Trees – Depth First Search & Breadth First Search

Write a Python program using the Python IDE based on recursion with trees that is both depth first and breadth first searches.

The Python program to be developed will demonstrate the use of both depth-first (DFS) and breadth-first (BFS) searches. A tree node structure will be developed that will be used both for DFS and BFS searches. The program will apply recursion both for the DFS and BFS searches to completion of the entire DFS and BFS. Also, the Python program will provide as output some of the intermediate nodes that are transverse during the execution of the DFS and BFS. This output of the intermediate nodes searched will demonstrate the different paths executed during a DFS versus BFS.

Problem

Develop functions to demonstrate understanding of implementing a recursive depth first search (DFS) and an iterative breadth first search (BFS) in Python using a simple graph made of nodes. This example will use nodes A, B, C, D, and E connected as follows:

           A -----
         /   \     |
       B-D-C   |
         \ | /    |
            E -----

The program must have the following:


Demonstration of writing a recursive depth first search (DFS) function.


Demonstration of writing an iterative breadth first search (BFS) function.


Documentation Guidelines:

Use good programming style (e.g., indentation for readability) and document each of your program parts with the following items (the items shown between the '<' and '>' angle brackets are only placeholders.  You should replace the placeholders and the comments between them with your specific information).  Your cover sheet should have some of the same information, but what follows should be at the top of each program's sheet of source code.  Some lines of code should have an explanation of what is to be accomplished, this will allow someone supporting your code years later to comprehend your purpose.  Be brief and to the point.  Start your design by writing comment lines of pseudocode.  Once that is complete, begin adding executable lines.  Finally run and test your program.

Deliverable(s):

Your deliverable should be a Word document with screenshots showing the source code and running results, and discuss the issues that you had for this project related to AWS and/or Python IDE and how you solved them for all of the programs listed above as well as the inputs and outputs from running themSubmit a cover sheet with the hardcopy of your work.

programming written in python code.

Homework Answers

Answer #1

Screenshots of source code as requested are as follows:

Screenshot of the output of the code is as follows

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using...
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using the following guidelines - Write two primary helper functions - one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of which Take the array and its size as input params and return a bool. Print out a message "Entering <function_name>" as the first statement of each function. Perform the code to test whether every element of the array is a Prime number. Print out...
Please indicate whether the following tasks would be better suited for a Breadth-First Search or a...
Please indicate whether the following tasks would be better suited for a Breadth-First Search or a Depth-First Search. Please explain your answer as well. EX. Find the minimum element in a binary search tree - DFS 1) Given a node n, find its nearest neighbour. 2) Find the shortest path between 2 vertices(nodes) in a graph. 3) Find the shortest cycle in a directed graph. 4) Find the longest cycle in a directed graph. 5) Which tree traversal scheme uses...
This is an intro to Python question: #Write a function called linear() that takes two parameters...
This is an intro to Python question: #Write a function called linear() that takes two parameters #- a list of strings and a string. Write this function so #that it returns the first index at which the string is #found within the list if the string is found, or False if #it is not found. You do not need to worry about searching #for the search string inside the individual strings within #the list: for example, linear(["bobby", "fred"], "bob") #should...
Please do the following in python: Write a program (twitter_sort.py) that merges and sorts two twitter...
Please do the following in python: Write a program (twitter_sort.py) that merges and sorts two twitter feeds. At a high level, your program is going to perform the following: Read in two files containing twitter feeds. Merge the twitter feeds in reverse chronological order (most recent first). Write the merged feeds to an output file. Provide some basic summary information about the files. The names of the files will be passed in to your program via command line arguments. Use...
0. Introduction. In this laboratory assignment, you will write a Python class called Zillion. The class...
0. Introduction. In this laboratory assignment, you will write a Python class called Zillion. The class Zillion implements a decimal counter that allows numbers with an effectively infinite number of digits. Of course the number of digits isn’t really infinite, since it is bounded by the amount of memory in your computer, but it can be very large. 1. Examples. Here are some examples of how your class Zillion must work. I’ll first create an instance of Zillion. The string...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how...
Delta airlines case study Global strategy. Describe the current global strategy and provide evidence about how the firms resources incompetencies support the given pressures regarding costs and local responsiveness. Describe entry modes have they usually used, and whether they are appropriate for the given strategy. Any key issues in their global strategy? casestudy: Atlanta, June 17, 2014. Sea of Delta employees and their families swarmed between food trucks, amusement park booths, and entertainment venues that were scattered throughout what would...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT