Results 1 to 2 of 2

Thread: swap method

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

    Unhappy swap method


    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
    Ljubljana, Slovenia
    Rep Power


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