Results 1 to 2 of 2

Thread: swap method

  1. #1
    leavearth is offline Member
    Join Date
    Apr 2010
    Posts
    1
    Rep Power
    0

    Unhappy swap method

    hello

    please who can help me solving this method...

    write the swap method that takes a string S as argument and prints all strings obtained by swapping of the string
    for example S="abc" this method should print the following:
    bac bca cab acb abc

    thanks in advance

  2. #2
    m00nchile is offline Senior Member
    Join Date
    Feb 2010
    Location
    Ljubljana, Slovenia
    Posts
    470
    Rep Power
    5

    Default

    This is a standard permutation assignment. Just google permutation, there are plenty of code examples. Of course, if you think about it a bit, and try to write it yourself, you'd be better off in the long run. A tip: recursion is your friend.

Similar Threads

  1. Swap characters in a string.
    By Sdannenberg3 in forum New To Java
    Replies: 4
    Last Post: 03-04-2010, 09:49 PM
  2. How to swap to images on clicks
    By ntagrafix in forum AWT / Swing
    Replies: 2
    Last Post: 12-03-2009, 09:13 PM
  3. swap two frames on user click
    By marodia in forum AWT / Swing
    Replies: 1
    Last Post: 08-25-2009, 10:11 AM
  4. Question about CAS (compare and swap) method
    By illidian in forum Advanced Java
    Replies: 1
    Last Post: 04-04-2008, 09:49 PM
  5. how to swap 2 numbers
    By mary in forum Advanced Java
    Replies: 1
    Last Post: 08-02-2007, 06:32 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
  •