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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:07:11+00:00 2026-05-12T14:07:11+00:00

I have a set of numbers which I need to put on a rectangular

  • 0

I have a set of numbers which I need to put on a rectangular grid as dense as possible (=the area of a grid is minimal). For example if I have to put numbers 16, 31, and 63, I can put them into 2×2-grid

1 6

3 0.

I think the best way to solve the problem for an arbitrary collection of numbers is to make some kind of net or tree which tries every permutation of numbers and the directions they can be read. I have difficulties to find a proper NextPosition()-algorithm which adds a number to a grid and tries every possible order of given numbers, positions where a given number starts, and direction of a given number. Can anyone suggest a method which tries every possible position?

  • 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-12T14:07:11+00:00Added an answer on May 12, 2026 at 2:07 pm

    Why are you doing this, what criteria determines which combination is the one you ultimately want (or are you working on all of them), and why isn’t 63 part of your grid, or why isn’t your grid 2×3?

    Lastly, if your grids are so small and non-sparse, wouldn’t you like to use an array?

    Okay.
    Then I would break every input number into digits, and for each first digit try to find that digit in the grid. Then search for the next digit, to see if it’s adjacent grid spot. If you can’t find any, you’d need to backtrack to the next match for the first digit. If there’s no existing occurrences, you need to start again looking to add the last digit into an empty space next to the first digit, assuming numbers are two digits. If it’s not possible, you need to either back track to the last number added, etc, or fail to say it’s not possible to add this number.

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

Sidebar

Related Questions

If have a big 'xsl:choose' chunk in which I need to set a number
I have a system in place which applies calculations to a set of numbers
Is it possible without using exponentiation to have a set of numbers that when
I have a set of records indexed by id numbers, I need to convert
I have a list of Phone Numbers which I need to convert into a
I have a large set of numbers, probably in the multiple gigabytes range. First
I have a set of positive numbers. Given a number not in the set,
I have a set of N^2 numbers and N bins. Each bin is supposed
I have a set of N positive numbers, and a rectangle of dimensions X
I actually have two questions: (1) Is it possible to put another image on

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.