Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8928327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:24:51+00:00 2026-06-15T08:24:51+00:00

I am implementing a 2-dimensional data structure for a class. My desired approach is

  • 0

I am implementing a 2-dimensional data structure for a class. My desired approach is an “NxN” Array of objects.

So,

    Cell[][] dataStructure = new Cell[N][N];

My current issue, is that I am very rusty with recursion. Each cell relies on the output of the cell to the left of it, and to the cell above it, to create its output.

Example of 2-D structure and how the outputs flow into the next cells

Example:

Assuming standard X,Y directions, I would like to be able to call a
getOutputX method for a cell, Cell[X][Y], and it would recursively
call getOutputX for Cell[X-1][Y] and getOutputY for Cell[X][Y-1] until
it reaches the edge of the array. At this point, the outputs would
propogate back through the array and return the desired output for the
cell.

As I write this out I’m understanding more as I go along, and I feel like I’m very close. Any helpful input or hints would be appreciated.

My specific question is how to create a getOutput method that would get the required input from both the cell above, and the cell to the left of the desired output.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:24:52+00:00Added an answer on June 15, 2026 at 8:24 am

    The algorithm is quite simple:

    int getOutput(x, y) {
        if (x == 0 || y == 0) {
            return hardCodedInput(x, y);
        }
        int leftOutput = getOutput(x - 1, y);
        int topOutput = getOutput(x, y - 1);
        return logicGate(x, y).applyLogic(leftOutput, topOutput);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A library I'm writing has a class implementing a two dimensional map and also
I am implementing a function that reads data from file into a multi-dimensional numpy
I am implementing a two dimensional array dynamic memory allocation . While compiling the
implementing publishActivity in PHP using the REST API using this code: $activity = array(
I am currently implementing a method that accepts two bitmap objects. We can assume
Possible Duplicates: Implementing a matrix, which is more efficient - using an Array of
I would like to find out safe ways of implementing three dimensional arrays of
I'm implementing my own matrix class in c++ to help me develop my understanding
Implementing ArrayAccess Interface in PHP , We can access Object Properties as Array Keys
I have a problem implementing this example in java, tableFilterDemo is a class that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.