SOME DIFFERENT KIND OF SELECTION SORTING OF ARRAY.

Discussion in 'C Programming' started by ANSHUL, Jul 4, 2006.

  1. ANSHUL

    ANSHUL Guest

    PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.

    SELECTION SORT IS BASED ON D FOLLOWING IDEA:
    SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
    ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
    ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
    HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
    TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
    THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.

    WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    PLZ , GIVE A SIMPLE LOGICAL CODE.
    ANSHUL, Jul 4, 2006
    #1
    1. Advertising

  2. ANSHUL

    Tobias Witek Guest

    ANSHUL wrote:
    > PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.
    >
    > SELECTION SORT IS BASED ON D FOLLOWING IDEA:
    > SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
    > ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
    > ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
    > HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
    > TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
    > THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.
    >
    > WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    > PLZ , GIVE A SIMPLE LOGICAL CODE.



    1. don't shout, it hurts my ears.
    2. rephrased, you want us to perform your homework.
    Tobias Witek, Jul 4, 2006
    #2
    1. Advertising

  3. ANSHUL

    santosh Guest

    ANSHUL wrote:
    > PLEASE PROVIDE ME D SOLUTION

    [snipped rest of the brawling]

    By convention all uppercase text signifies shouting, so in future,
    refrain from it if you want helpful responses.

    Also provide the email of your course instructor, so that we may save
    you the hassle and mail the answer to him/her directly.

    Seriously though, this group won't do your homework for you. Try
    atleast a partial attempt at solving your problem and post your code
    here and we'll be more than happy to help you, but with this attitude,
    you likely wont get any helpful responses.
    santosh, Jul 4, 2006
    #3
  4. ANSHUL

    osmium Guest

    "ANSHUL" writes:

    > SELECTION SORT IS BASED ON D FOLLOWING IDEA:
    > SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
    > ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
    > ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
    > HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
    > TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
    > THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.


    Why would you want someone else to write the code for you? What would be
    gained? The question seems about as clear as a question can be, ignoring
    what I suspect is the distortion you introduced yourself. There are just a
    few main steps: create an array, fill the array (with a set of test data),
    sort the array, and print the array (to show the sort actually worked). If
    you create an array in main you could have three functions as suggested
    above. You may want to have the sort function call additional functions -
    its your choice. It would be a good idea to (also) print the array as soon
    as you have it filled with data to see if the fill worked.

    If you have been taught recursion, it might be helpful in writing the sort -
    if not do it whatever way seems natural to you.

    If you can't do the whole thing, start and post code showing how far you
    got.
    osmium, Jul 4, 2006
    #4
  5. On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
    <> wrote:

    >WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    >PLZ , GIVE A SIMPLE LOGICAL CODE.


    Fortran programmer?

    --
    Mark McIntyre

    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan
    Mark McIntyre, Jul 4, 2006
    #5
  6. ANSHUL

    John F Guest

    Mark McIntyre wrote:
    > On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
    > <> wrote:
    >
    >> WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    >> PLZ , GIVE A SIMPLE LOGICAL CODE.

    >
    > Fortran programmer?


    LOL!!!!

    --
    Johannes
    You can have it:
    Quick, Accurate, Inexpensive.
    Pick two.
    John F, Jul 4, 2006
    #6
  7. On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
    <> wrote:

    >PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.
    >
    >SELECTION SORT IS BASED ON D FOLLOWING IDEA:
    >SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
    >ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
    >ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
    >HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
    >TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
    >THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.
    >
    >WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    >PLZ , GIVE A SIMPLE LOGICAL CODE.


    Anshul.
    Firstly please write in sentence-case if possible, when posting to
    usenet. Most people find ALL UPPER CASE hard to read, and by
    convention it is considered to be shouting (ie you are being rude).

    Secondly please don't use abbreviations such as D for the, PLS for
    please, DIS for this or V for we. The programming community here
    values correctness, and poorly spelt messages often come from badly
    organized minds.

    Lastly, do not expect people to write your code for you. You should
    make an effort to write it yourself, then when you are stuck with a
    problem, ask for specific help.

    --
    Mark McIntyre

    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan
    Mark McIntyre, Jul 4, 2006
    #7
  8. ANSHUL

    Ian Collins Guest

    Mark McIntyre wrote:
    > On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
    > <> wrote:
    >
    >
    >>WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    >>PLZ , GIVE A SIMPLE LOGICAL CODE.

    >
    >
    > Fortran programmer?
    >

    Ah, that explains it, I thought he/she was a Teletype user...

    --
    Ian Collins.
    Ian Collins, Jul 4, 2006
    #8
  9. ANSHUL schrieb:
    > PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.
    >
    > SELECTION SORT IS BASED ON D FOLLOWING IDEA:
    > SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
    > ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
    > ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
    > HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
    > TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
    > THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.
    >
    > WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    > PLZ , GIVE A SIMPLE LOGICAL CODE.


    Here is it:

    #include <stdio.h>
    #include <ctype.h>

    int main()
    {
    int c;
    while ((c = getchar()) != EOF)
    putchar(tolower(c));
    }

    --
    Thomas
    Thomas J. Gritzan, Jul 5, 2006
    #9
  10. ANSHUL

    Jack Klein Guest

    On 4 Jul 2006 09:32:59 -0700, "ANSHUL" <> wrote in
    comp.lang.c:

    > PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.
    >
    > SELECTION SORT IS BASED ON D FOLLOWING IDEA:
    > SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
    > ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
    > ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
    > HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
    > TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
    > THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.
    >
    > WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    > PLZ , GIVE A SIMPLE LOGICAL CODE.


    PLZ, PICK UP D LARGE HAMMER AND HIT URSELF IN D HEAD. V ARE WAITING.

    --
    Jack Klein
    Home: http://JK-Technology.Com
    FAQs for
    comp.lang.c http://c-faq.com/
    comp.lang.c++ http://www.parashift.com/c -faq-lite/
    alt.comp.lang.learn.c-c++
    http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html
    Jack Klein, Jul 5, 2006
    #10
  11. ANSHUL

    Richard Bos Guest

    Jack Klein <> wrote:

    > On 4 Jul 2006 09:32:59 -0700, "ANSHUL" <> wrote in
    > comp.lang.c:
    >
    > > PLEASE PROVIDE ME D SOLUTION CODE FOR DIS PROBLEM.
    > >
    > > SELECTION SORT IS BASED ON D FOLLOWING IDEA:
    > > SELECTING D LARGEST ARRAY ELEMENT AND SWAPPING IT WITH THE LAST ARRAY
    > > ELEMENT LEAVES AN UNSORTED LIST WHOSE SIZE IS I LESS THAN THE SIZE OF
    > > ORIGINAL LIST. IF V REPEAT THIS STEP AGAIN ON D UNSORTED LIST V WILL
    > > HAVE AN ORDERED LIST OF SIZE 2 AND UNORDERED LIST SIZE OF N-2(N IS D
    > > TOTAL NUMBER OF ARRAY ELEMENTS).WHEN WE REPEAT THIS UNTIL THE SIZE OF
    > > THE UNSORTED LIST BECOMES ONE, THE RESULT WILL BE A SORTED LIST.
    > >
    > > WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    > > PLZ , GIVE A SIMPLE LOGICAL CODE.

    >
    > PLZ, PICK UP D LARGE HAMMER AND HIT URSELF IN D HEAD. V ARE WAITING.


    I believe V prefer live prey.

    Richard
    Richard Bos, Jul 5, 2006
    #11
  12. ANSHUL

    Bill Pursell Guest

    Ian Collins wrote:
    > Mark McIntyre wrote:
    > > On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
    > > <> wrote:
    > >
    > >
    > >>WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    > >>PLZ , GIVE A SIMPLE LOGICAL CODE.

    > >
    > >
    > > Fortran programmer?
    > >

    > Ah, that explains it, I thought he/she was a Teletype user...


    I figured he was following the strupr thread and was excited
    to get the code to work.
    Bill Pursell, Jul 5, 2006
    #12
  13. ANSHUL

    John F Guest

    Bill Pursell wrote:
    > Ian Collins wrote:
    >> Mark McIntyre wrote:
    >>> On 4 Jul 2006 09:32:59 -0700, in comp.lang.c , "ANSHUL"
    >>> <> wrote:
    >>>
    >>>
    >>>> WRITE A PROGRAM IN C LANGUAGE TO IMPLEMENT THIS ALGORITHM.
    >>>> PLZ , GIVE A SIMPLE LOGICAL CODE.
    >>>
    >>>
    >>> Fortran programmer?
    >>>

    >> Ah, that explains it, I thought he/she was a Teletype user...

    >
    > I figured he was following the strupr thread and was excited
    > to get the code to work.


    He almost got it to work, but it still mangles some of the shorter
    words... still a lot of work to do on it as it seems...

    --
    John
    You can have it:
    Quick, Accurate, Inexpensive.
    Pick two.
    John F, Jul 5, 2006
    #13
  14. On Wed, 05 Jul 2006 06:46:18 GMT, in comp.lang.c ,
    (Richard Bos) wrote:

    >I believe V prefer live prey.


    Ah, that takes me back.
    Robert Englund in a role other than Freddy.
    --
    Mark McIntyre

    "Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are,
    by definition, not smart enough to debug it."
    --Brian Kernighan
    Mark McIntyre, Jul 5, 2006
    #14
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Niederberger
    Replies:
    2
    Views:
    16,405
    Christian Kaufhold
    Jan 7, 2005
  2. Joseph Turian
    Replies:
    11
    Views:
    495
    Joseph Turian
    Jan 19, 2005
  3. gk
    Replies:
    3
    Views:
    277
    Daniel Dyer
    Sep 16, 2006
  4. dwelden
    Replies:
    11
    Views:
    472
    Neil Cerutti
    Jan 4, 2007
  5. Henrik J?nsson

    Q: Printing a selection (kind of)

    Henrik J?nsson, Oct 13, 2003, in forum: Javascript
    Replies:
    2
    Views:
    76
    Henrik J?nsson
    Oct 14, 2003
Loading...

Share This Page