Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2013
    Posts
    71
    Rep Power
    0

    Post for a given String object defined, will write all permutations of the String

    So the prompt is asking me to write a program that for a given String object in the code, will write strings to a file corresponding to all possible permutations of the words in the string. like "i love you", the output to the file would be "i love you", "love you i", "you love i", etc. I don't really know how to start this. any help will be appreciated. thx ppls

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    4,026
    Rep Power
    6

    Default Re: for a given String object defined, will write all permutations of the String

    IMHO writing code to generate permutations is not a topic for someone new to programming. Usually, recursion is involved but it isn't required. However, I suggest you focus on just generating permutations of a set of integers. You can surf for permutation algorithms if you choose. Once you figure it out, adapting your solution to words in a sentence should be trivial.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    Join Date
    Jun 2013
    Posts
    71
    Rep Power
    0

    Default Re: for a given String object defined, will write all permutations of the String

    Quote Originally Posted by jim829 View Post
    IMHO writing code to generate permutations is not a topic for someone new to programming. Usually, recursion is involved but it isn't required. However, I suggest you focus on just generating permutations of a set of integers. You can surf for permutation algorithms if you choose. Once you figure it out, adapting your solution to words in a sentence should be trivial.

    Regards,
    Jim
    thanks Jim, ill look into recursion :)
    P.S. i feel like a pro after you said this problem isn't for rookies xD

Similar Threads

  1. How to resize one String already defined?
    By NoobWhoMakeQuestions in forum New To Java
    Replies: 2
    Last Post: 05-07-2012, 04:04 PM
  2. Replies: 1
    Last Post: 01-09-2012, 05:46 PM
  3. help with permutations of a string
    By hoosierfan24 in forum New To Java
    Replies: 8
    Last Post: 05-25-2011, 07:35 PM
  4. Casting a String object to a Form object
    By kakinyim in forum CLDC and MIDP
    Replies: 0
    Last Post: 04-23-2011, 12:41 PM
  5. Replies: 4
    Last Post: 03-25-2008, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •