Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Algorithm for card sorting

  1. #1
    Member Scorks's Avatar
    Join Date
    Jan 2013
    Posts
    56
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Algorithm for card sorting

    I need to find an algorithm to sort a deck of cards with THREE rules.

    1. We can only look at the top 2 cards on the scrambled deck.
    2. We may flip the two cards around if we wish
    3. The top card goes to the bottom of the deck

    (repeat)

    I've tried recreating this situation physically with some cards, and I imagine it looks similar to bubble sort where we try to bubble the smallest number to the bottom of the deck, then the next smallest, and so on and so forth. I just can't seem to get it to work smoothly. So basically I'm looking for other methods of approaching this problem.

    Thanks


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Algorithm for card sorting

    What does "smoothly" mean in programming? I'd be happy if it worked, smoothly or not, so apparently it doesn't work at all.

    You can't use other methods. The method is given to you, very specifically. I'm not sure what your question is.

Similar Threads

  1. HELP! Luhn Algorithm Credit Card Validation
    By suzan in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 8th, 2022, 10:17 AM
  2. Replies: 3
    Last Post: June 10th, 2013, 04:42 AM
  3. Issues with sorting algorithm
    By RAWBERRY in forum What's Wrong With My Code?
    Replies: 6
    Last Post: May 1st, 2012, 05:13 PM
  4. Basic Java Sorting Algorithm (Selection/Insertion) help
    By Arte7 in forum Algorithms & Recursion
    Replies: 5
    Last Post: August 22nd, 2011, 01:38 PM
  5. 2 Java methods and a sorting algorithm
    By Tiberius in forum Algorithms & Recursion
    Replies: 0
    Last Post: February 26th, 2011, 03:41 PM

Tags for this Thread