Strona główna > Sortowanie > Sortowanie przez wybor C

Sortowanie przez wybor C

29 Czerwiec 2011 Dodaj komentarz Go to comments
//Sortowanie przez wybor (implementacja w C)
#include <stdio.h>

void zamiana(int *a,int *b){
     int tmp;
     tmp=*a;
     *a=*b;
     *b=tmp;
}

void wybor (int t[],int N){
   int i,m,j,tmp;
   for( i=0;i<N-1;i++)
   {
     m=i;
     for(j=i+1;j<N;j++)   
     if(t[j]<t[m]) m=j;
     zamiana(&t[i],&t[m]);     
   }
}

int main()
{
    const int N=10;
    int i,tab[N];
    srand((unsigned)time(NULL));

    for (i=0;i<N;i++)
    tab[i]=rand()%100;
    for (i=0;i<N;i++)
    printf("%d  ", tab[i]);
    printf("\n");
    wybor(tab,N);
    printf("Po sortowaniu:\n");
    for (i=0;i<N;i++)
    printf("%d  ", tab[i]);
    printf("\n");
    system("pause");
    return 0;
}
  1. 11 Czerwiec 2013 o 3:24 pm

    The longest of all the workouts, this cardio and body sculpting routine
    is a 45 minute workout blitz that will have your abs burning in no time.
    About twenty-five reps are desired, in sets of three.

    The plank and side plank are both useful for toning the abs
    and back at the same time, adding stability to your core.

  2. 26 Czerwiec 2013 o 5:52 pm

    I like the valuable information you supply to your articles.
    I’ll bookmark your blog and take a look at again right here frequently. I’m slightly certain I will
    learn lots of new stuff proper here! Best of luck
    for the following!

  3. 8 Wrzesień 2013 o 7:44 am

    I enjoy reading a post that can make men and women
    think. Also, thank you for allowing me to comment!

  4. buy
    1 Grudzień 2013 o 5:06 am

    Hello tto every one, it’s in fact a pleasant for me to pay a visit this website, it consists of useful Information.

  5. 9 Luty 2014 o 12:38 pm

    WOW just what I was looking for. Came here by searching for
    cheap meals recipes

  6. 4 Sierpień 2014 o 7:45 pm

    Heya i’m for the first time here. I came across this board and I find It
    really useful & it helped me out much. I hope to give something back and aid others like you aided me.

  7. 15 Sierpień 2014 o 10:38 pm

    I was suggested this web site by my cousin. I am not sure whether this
    post is written by him as nobody else know such detailed about my problem.
    You’re incredible! Thanks!

  8. 28 Sierpień 2014 o 3:49 am

    Yes! Finally someone writes about cardio.

  9. 30 Sierpień 2014 o 3:21 am

    Piece of writing writing is also a excitement, if you be acquainted with after that you can write if not it is difficult
    to write.

  10. 9 Wrzesień 2014 o 2:56 pm

    Sweet blog! I found it while surfing around on Yahoo News.

    Do you have any tips on how to get listed in Yahoo News?
    I’ve been trying for a while but I never seem to get
    there! Cheers

  11. 11 Wrzesień 2014 o 2:37 am

    I have been exploring for a little bit for any high-quality articles or blog posts on this sort of space .
    Exploring in Yahoo I eventually stumbled upon this website.
    Reading this information So i’m happy to express that I have a very just right uncanny feeling I
    found out exactly what I needed. I most certainly will make sure to do not overlook this site
    and give it a glance regularly.

  12. 11 Wrzesień 2014 o 3:32 am

    Hello everyone, it’s my first pay a visit at this website, and article is in fact fruitful designed for me, keep up
    posting these articles or reviews.

  13. 13 Wrzesień 2014 o 12:02 am

    Hi, after reading thjs awesome paragraph i am too delighted to
    share my knowledge here with friends.

  14. ...
    13 Wrzesień 2014 o 1:30 pm

    Hmm it looks like your site ate my first comment (it was super long) so I
    guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog.
    I as well am an aspiring blog blogger but I’m still new to everything.
    Do you have any tips for novice blog writers?
    I’d definitely appreciate it.

  15. 6 Październik 2014 o 4:28 am

    Another awesome positive for the expo was the choice in bringing 8-bit-weapon in because they helped energize the flow of everything going on in the convention showroom and magnified the retro experience 100 fold.
    Sports video games have a short shelf life, as each passing season ushers
    in newly updated versions with revised rosters.
    The average depth of the sea 180 meters, the highest in Lankaran depression – 1020 m; the
    lowest – in the north – 5 m.

  16. 16 Październik 2014 o 10:35 pm

    I blog frequently and I truly appreciate your content. This article has really peaked my interest.
    I am going to bookmark your website and keep checking for new details about
    once a week. I opted in for your RSS feed too.

  17. 9 Kwiecień 2016 o 12:37 am

    I simply couldn’t depart your site before suggesting that I really enjoyed the usual information an individual provide
    on your visitors? Is going to be back ceaselessly in order to inspect new posts

  18. 27 Maj 2016 o 1:38 am

    Hello friends, its fantastic paragraph regarding cultureand entirely explained, keep it up all the
    time.

  19. 27 Maj 2016 o 8:20 pm

    Pretty section of content. I simply stumbled upon your blog and in accession capital to claim that I get actually enjoyed account your weblog posts.
    Any way I will be subscribing on your augment or even I fulfillment you get entry to constantly quickly.

  1. 8 Październik 2014 o 10:37 am
  2. 23 Październik 2014 o 6:30 am

Skomentuj

Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:

Logo WordPress.com

Komentujesz korzystając z konta WordPress.com. Log Out / Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Log Out / Zmień )

Facebook photo

Komentujesz korzystając z konta Facebook. Log Out / Zmień )

Google+ photo

Komentujesz korzystając z konta Google+. Log Out / Zmień )

Connecting to %s

%d bloggers like this: