Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Written in Java Consider an NX N grid in which some squares are occupied. Two squares belong to the same group if they share a

Written in Java

Consider an NX N grid in which some squares are occupied. Two squares belong to the same group if they share a common edge. In Figure 7.30 there is one group of four occupied squares, three groups of two occupied squares, and two individual occupied squares. Assume that the grid is represented by a two-dimensional array. Write a program that a. Computes the size of a group when a square in the group is given b. Computes the number of different groups c. Lists all groups

For both problems read the grids from a text file specified by the user. The grid for 7.46 will consist of 0 or 1 for each coordinate followed by a space

Grid

0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Things it needs to do

Build Grid from user specified file Compute the size of group specified by user

Compute the number of different groups

List all groups with sizes

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

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

2. Ask several students to explain the directions.

Answered: 1 week ago

Question

Describe the factors influencing of performance appraisal.

Answered: 1 week ago

Question

What will you do or say to Anthony about this issue?

Answered: 1 week ago