Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Write java prgrm that determines the size of the largest sector for a given grid.

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Write java prgrm that determines the size of the largest sector for a given grid.

    Problem Statement - Counting Cells in a Sector

    Consider a two-dimensional grid of cells, each of which may be empty or filled. The filled cells that are connected form a sector. Two cells are said to be connected if they are adjacent to each other horizontally, vertically or diagonally. There may be several sectors on the grid. Your job is to find the largest sector (in terms of number of cells) on the grid.

    The following figure illustrates a grid with 3 sectors (the largest contains 5 cells).



    Problem
    Write a program that determines the size of the largest sector for a given grid.

    Input
    The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs. The grid is given as a set of string, each composed of 0s and 1s. The 1 indicates that the cell is filled and 0 indicates an empty cell. The strings should be converted into the grid format. The largest grid that should be considered is a 25x25 grid.

    Output
    For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line. The output is the size of the largest sector found on the grid.

    Sample Input
    2

    11000
    01100
    00101
    10001
    01011

    1011
    1010

    Sample Output
    5
    3

    Email Programming Test.zip


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: Write java prgrm that determines the size of the largest sector for a given grid.

    1. Welcome to Java Programming Forums.
    2. Read Java Programming Forums - The Java Community - Official Forum Rules

Similar Threads

  1. program that determines largest and smallest
    By Reverie in forum Loops & Control Statements
    Replies: 4
    Last Post: February 26th, 2012, 08:41 PM
  2. Replies: 3
    Last Post: October 19th, 2011, 03:17 PM
  3. HELP! HOW TO PRINT A GRID IN JAVA (NO GUI...)
    By imicrothinking in forum Java Theory & Questions
    Replies: 0
    Last Post: October 19th, 2011, 09:39 AM
  4. Java applet for Fibonacci grid
    By jnapoles in forum Java Applets
    Replies: 1
    Last Post: January 27th, 2011, 01:56 AM
  5. java grid and colors/graphics
    By ajmukon in forum What's Wrong With My Code?
    Replies: 10
    Last Post: January 25th, 2011, 03:38 PM

Tags for this Thread