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

  • SEARCH
  • Home
  • 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 7900443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:58:19+00:00 2026-06-03T08:58:19+00:00

I have a grid of NxN cells (think of a 2 dimensional array defined

  • 0

I have a grid of NxN cells (think of a 2 dimensional array defined as follows Array[N][N]).

Which algorithm will compute every path from every cell a[i][j] to every cell a[k][l] where:

  1. No cell is included twice within a single path.
  2. Only adjacent diagonal, horizontal and vertical moves all legal.
  3. The algorithm is the fastest, on average.
  4. The least amount of memory is used.
  • 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-03T08:58:20+00:00Added an answer on June 3, 2026 at 8:58 am

    I assume you want the actual paths, and not just the number of them.

    You can achieve it by using DFS that maintains visited set on the vertices explored in the same path, and avoids exploring a vertex that was already discovered in the same path.

    Pseudo code:

    DFS(v,target,visited):
       if (v == target):
          print path to v from the initial sorce
          return
       visited.add(v)
       for each vertex u such that u is a neighbor of v:
          if (u is not in visited):
              u.parent <- v
              DFS(u,target,visited)
       visited.remove(v)
    

    invoke with DFS(source,target,{}) [where {} is an empty visited set].

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a NxN grid with some values, which change every time step. I
Suppose you have an NxN grid, and you want to visit every cell exactly
I have an array of size n^2 representing a square grid of size nxn.
I have Grid which will render a calendar, and I'm provided with an ArrayList<CalendarEventEntity>
I have grid with some textboxes and an image which goes out of grid
I have a grid which I would like to show extra information with RowExpander
I have a NxN grid of values and a 2xM list of x,y data
I have grid which displays users information. I have commandColumn with edit, delete commands.
I have grid in my page which have four columns with multiple rows Userid
I have grid view which contains five radio buttons per row. Out of these

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.