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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:13:27+00:00 2026-05-16T06:13:27+00:00

Possible Duplicates: Display possible combinations of string algorithm that will take numbers or words

  • 0

Possible Duplicates:
Display possible combinations of string
algorithm that will take numbers or words and find all possible combinations

If I have 3 strings, such as:

"abc def xyz"

And I want to find the max number of combinations I can generate by rearranging these strings, e.g:

  • abc xyz def
  • def xyz abc
  • xyz abc def

etc. What’s the formula/algorithm for calculating this?

  • 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-16T06:13:28+00:00Added an answer on May 16, 2026 at 6:13 am

    This is not a combination but permutation. The algorithm is n! where n is the number of elements.

    Why ?

    Because you have 3 values to place on three places, so for the first place You have three option, for second only two (becuase You already palace first string) and at the end You have only one option.

    3 * 2 * 1 = 3! = 6

    But if You can repeate those chooses than you have permutation with repetition

    So for first place You can chose from 3 string and for the second also and so one

    3 * 3 * 3 = 3^3 = 27

    n^k – where n is the number of strings and k – the number of “locations”

    And the code algorithm look like this:

    function fact($n)
    {
      if ($n == 0)
      {
        return 1;
      }
      else
      {
        return $n * fact($n - 1);
      }
    }
    

    This is a recursive example

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

Sidebar

Related Questions

Possible Duplicate: display text in uiwebview in iphone I have a String in HTML
Possible Duplicate: Is there a tool that can display a SVN repository visually (
Possible Duplicates: Is String.Format as efficient as StringBuilder C# String output: format or concat?
Possible Duplicates: Is there a problem that has only a recursive solution? Can every
Possible Duplicate: Why doesn’t VS 2008 display extension methods in Intellisense for String class
Possible Duplicate: Display numbers from 1 to 100 without loops or conditions Interview question:
Possible Duplicate: Display numbers with ordinal suffix in PHP I think they are called
Possible Duplicate: How to display row numbers in a ListView? Currently I am using
I'd like to use MySQL to find duplicates and then display those items as
Possible Duplicate: IE7 display issues (adding extra top margin) So I have the following

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.