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

Ask A Question

Stats

  • Questions 270k
  • Answers 270k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If there are no other references to _watcher, then there… May 13, 2026 at 1:30 pm
  • Editorial Team
    Editorial Team added an answer I finally managed to get this to work. I followed… May 13, 2026 at 1:30 pm
  • Editorial Team
    Editorial Team added an answer Are you looking for something similar to the the Levenshtein… May 13, 2026 at 1:30 pm

Related Questions

Background: I'm working with permutations of the sequence of integers {0, 1, 2 ...
I have a set of numbers ~100, I wish to perform MC simulation on
I have a set of, oh 8000 or so files, that I need to
I'm pretty fresh to database handling, but now completely without experience. However, I have

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.