Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

 1 Answer(s)

  • I have a solution, not the fastest one, but it respect the conditions. Imagine your list is :

    class LinkedInt
        int integer;
        LinkedInt next;
        LinkedInt(int integer)
            this.integer = integer;

    Then you can sort like this :

    void sort(LinkedInt linkedInt)
         if (linkedInt == null || == null)
         LinkedInt current = linkedInt;
         int temp;
         while ( != null && current.integer >
             temp = current.integer;
             current.integer =;
    = temp;
            current =;

    It sorts, it is recursive, it have only one parameter and not depends on other method. The idea : we sort the queue first, then since queue is sorted, it is easy to push the value to the good place. Hope it's Help JHelp

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: