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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:56:56+00:00 2026-05-24T18:56:56+00:00

Basically, my program will try to generate the list of all possible lowercase 5-letter

  • 0

Basically, my program will try to generate the list of all possible lowercase 5-letter words. Including all combinations that clearly are not real words like jshcc or mmdzq.

I do that by stacking up a massive amount of calls for a function, which does the word work.

But that’s simply too much, and I get a stack overflow error.

How would someone control that?

  • 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-24T18:56:58+00:00Added an answer on May 24, 2026 at 6:56 pm

    Basically, convert from recursion to iteration. Typically that involves creating a Stack<T> as a “logical” stack, or something similar.

    However, I’d have expected a method generating a list of all possible 5-letter words to only have a stack about 5 deep – one for each letter. Each stack level would be responsible for one level of letter – so the “top” of the stack would iterate through each possible last letter; the next stack frame down would iterate through every possible fourth letter, calling the method recursively to iterate through all possible last letters etc. Something like this (C# code, but hopefully you can understand it and apply it to VB):

    const string Letters = "abcdefghijklmnopqrstuvwxyz";
    
    public static List<string> GenerateValidWords(int length)
    {
        List<string> words = new List<string>();
        GenerateValidWords(0, new char[length], words);
        return words;
    }
    
    private static void GenerateValidWords(int depth, char[] current,
                                           List<string> words)
    {
        foreach (char letter in letters)
        {
            current[depth] = letter;
            if (depth == current.Length - 1)
            {
                string word = new string(current);
                if (IsValid(word))
                {
                    words.Add(word);
                }
            }
            else
            {
                GenerateValidWords(depth + 1, current, words);
            }
        }
    }
    

    Now if you don’t have any sort of filtering, that’s going to generate 11,881,376 words – which at 24 bytes each (on x86) is about 285MB – plus all the space for the list etc. That shouldn’t kill a suitably big machine, but it is quite a lot of memory. Are you sure you need all of these?

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

Sidebar

Related Questions

Basically I want to make simple toggle program (that will be mapped to some
Right what im trying to accomplish is a program that basically sets the active
Basically, is it possible to identify if some-one hooks up my program to SQL
I have a Java program that generates Java classes for my application. Basically it
Basically, I have a program which will be launched more than once. So, there
I'm writing this program that will need to access the registry to pull some
basically the problem is, that the only way to get all instances of VLC
Basically the program takes customer information and dumps it in a database. In order
I am using a facade design pattern for a C# program. The program basically
Basically, I want to have my program retrieve various variables from the hard drive

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.