Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

We are required to use a two 2D array as the background/floor/grid for a picture in which we have to generate random blocks within that

We are required to use a two 2D array as the background/floor/grid for a picture in which we have to generate random blocks within that grid and store it in the array. JAVA coding We have to have two functions one is depth first search using stacks class, and the other is depth first search using queues class. Please use double pointers when creating the arrays. One array has to pass through DFS and the other through BFS. The point in this project to show that the result is the same, but the timing is different. The functions should look similar to this:- generateArray(int **arrayA, int **arrayB); depthFirstSearch(int **arrayA); breadthFirstSearch(int **arrayB); displayArrayA(); displayArrayB(); Important Design Requirement: Your design must be based on Modularity and "Separation of Concerns". The Stack and Queue Data Structure implementations must be based on "Information Hiding" and "Encapsulation". The Application Code (e.g. Rat In Maze, Wire Router, Image Component Labeling, ...) know about the Data Structures only through their Interfaces (APIs). Remember that interfaces represent behavior, while classes represent implementation. Image Component Labeling A digitized image is an m x m matrix of pixels. - pixel is a word invented from picture elementSolution Strategy The components are determined by scanning the pixels by rows, from top to bottom, and within each row by coImage Component Labeling Example 1 1 1 1 1 1 1 DS&A Image Component Labeling Slide # 4Image Component Labeling Example 5515 5 4 616 DS&A Image Component Labeling Slide # 5Implementation o The program to label component pixels uses much of the development used for the Rat in the Maze and LeesImportant Design Requirement Your design must be based on Modularity and Separation of Concerns The Stack and Queue Data StrGeneral Strategy 1) Prompt the user for two values - The DIMENSION of the image in pixels (square grid of pixels) Must be anGeneral Strategy - continue For the purpose of illustration here, assume only for now, that the user chooses a DIMENSION of 1General Strategy- continue 3) Create imageDFS by randomly generating the pixel values The generatelmage operation will populaGenerating a Random Images Let R be the DENSITY, where 0 R 1 a The following pseudocode is used to populate the pixelsquare aGeneral Strategy-continue 4) Create imageBFS as an identical copy of imageDFS After populating the grid with pixel values andExample - Initial (After random pixel generation) Suppose the user entered 0,x 0,x 0,x0,x 0,x 0,x 0,x 0,x 1,x1,x 1,x 0,x 0,xExample - Corresponding DFS 0,x 0,x0,x 0,x 0,x0,x 0,x 0, 1,1 1,2 1,3 0,x 0,x 0,x 0,x 1,8 1,40x 2,1 2,2 2,3 0,x 1,7 1,5 1,6 0,Example - Corresponding BFS 0,x 0,x0,x0,x0,x0,x 0,x 0,x 1,1 1,2 1,40,x 0,x 0,x 0,x 1,3 1,5 0,x2,12,2 2,3 0,x 1,6 1,7 1,80,x 2

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

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

Students also viewed these Databases questions

Question

What are the three basic ways in which data sets can be classified?

Answered: 1 week ago

Question

What is the preferred personality?

Answered: 1 week ago