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 7443553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:20:53+00:00 2026-05-29T11:20:53+00:00

Assume the following is a 2d array that we are operating on a b

  • 0

Assume the following is a 2d array that we are operating on

a b c d
e f g h
i j k l
m n o p

The surrounding neighbor of ‘f’ are [a b c e g i j k]. I’m trying to create a cache friendly data structure to store the neighbor of a node. Right now I have something like so

struct Neighbor{
   size_t neighborPosition[8][2];
   size_t size;
};

typedef size_t Position[2];
typedef Neighbor** NeighborTable;

Note that the max neighbor a node could have is 8. Anyone have any advice? I need the structure to be a constant time neighbor lookup so I will be pre-calculating the neighbor of each node.

  • 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-05-29T11:20:54+00:00Added an answer on May 29, 2026 at 11:20 am

    Every cell has the same neighbors, in terms of their relative location, except for the edge cells. But if you add a border (an extra row & column at the start and end), and fill it with a value that lets you know it is a border, the you don’t need any data structure at all to identify neighbors.

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

Sidebar

Related Questions

Assume I have an array of doubles that looks like the following: Array[10] =
Background Assume I have the following nested variable in PHP. $data = Array( Array('lname'
assume this following function: int binaryTree::findHeight(node *n) { if (n == NULL) { return
Assume that the following Perl code is given: my $user_supplied_string = &retrieved_from_untrusted_user(); $user_supplied_string =~
I'm trying to grab the text from options in a dropdown list. Assume that
I want to pull a specific item from an embedded array...assume the following mongo
Assume I have an array $arr. It's possible that it has an element with
Assume the following arrays are given: a = array([1, 3, 5]) b = array([2,
Assume that I need to insert the following document: { title: 'Péter' } (note
I'm trying to create a checkout page in PHP. The page that lists the

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.