EdyWinarno.Com

|Computer|Blogging|Programming|Informatics|Network|Technology|

Metode Sorting pada Algoritma dan Pemrograman

Comments Off
Posted by edy winarno on March 7, 2010 at 1:34 am

Sorting adalah operasi untuk membuat berkas data dalam kondisi urut naik atau turun.
Masalah :

  • untuk jumlah data yang besar, perlu adanya metode yang efisien (membutuhkan waktu yang singkat)
  • tanpa metode yang efisien, kegiatan sorting dapat memakan waktu sampai berjam-jam

Metode sorting : metode seleksi, metode bubble, metode sisipan, metode cepat, metode radix, metode pohon biner, metode merge, metode shell, metode tournament, metode heap.

1 Metode Seleksi:

Algoritmanya adalah sebagai berikut:

-         Dicari data yang terkecil (terbesar) dari data pertama sampai terakhir, lalu data terkecil (terbesar) ditukar dengan data pertama.

-         Data terkecil (terbesar) dicari mulai dari data kedua sampai data terakhir, lalu data terkecil (terbesar) ditukar dengan data kedua.

-         Demikian seterusnya sehingga terurutkan naik atau turun, tergantung yang dikehendaki.

Metode ini cocok untuk struktur data larik, maupun rantai.

Contoh penggunaan metode seleksi (lihat pada halaman berikutnya):

I

A(I)

Lewatan ke-

1

2

3

4

5

6

7

8

9

1

42

11

11

11

11

11

11

11

11

11

2

23

23

23

23

23

23

23

23

23

23

3

74

74

74

36

36

36

36

36

36

36

4

11

42

42

42

42

42

42

42

42

42

5

65

65

65

65

65

58

58

58

58

58

6

58

58

58

58

58

65

65

65

65

65

7

94

94

94

94

94

94

94

74

74

74

8

36

36

36

74

74

74

74

94

87

87

9

99

99

99

99

99

99

99

99

99

94

10

87

87

87

87

87

87

87

87

94

99

2 Metode Bubble

Algoritmanya adalah sebagai berikut:

-         Elemen data pertama dibandingkan dengan elemen kedua. Bila elemen kedua lebih kecil (besar), kedua elemen tersebut ditukar.

-         Elemen data kedua dan ketiga dibandingkan. Bila dipenuhi syarat seperti langkah sebelumnya, kedua elemen tersebut ditukar.

-         Proses terus berlangsung dengan elemen ketiga dan keempat, dan seterusnya sampai akhir deretan rekaman.

-         Apabila sudah tidak ada elemen yang ditukarkan, proses berhenti dan selesai. Bila terjadi pertukaran selama lewatan, proses akan diulang. Sehingga akhirnya semua elemen tersusun, tidak ada pertukaran lagi, dan algoritma berhenti.

Contoh penggunaan metode bubble (lihat halaman berikutnya):

I

A(I)

Lewatan ke-

1

2

3

4

5

6

1

42

23

23

11

11

11

11

2

23

42

11

23

23

23

23

3

74

11

42

42

42

36

36

4

11

65

58

58

36

42

42

5

65

58

65

36

58

58

58

6

58

74

36

65

65

65

65

7

94

36

74

74

74

74

74

8

36

94

87

87

87

87

87

9

99

87

94

94

94

94

94

10

87

99

99

99

99

99

99

3 Metode Sisipan

Algoritmanya adalah sebagai berikut:

-         rekaman pertama ditempatkan pada posisi pertama dalam suatu daftar baru. Selanjutnya data kedua dibandingkan dengan data pertama tersebut. Pada pemilahan data urut naik, bila data kedua lebih kecil, rekaman pertama tadi digeser satu posisi ke bawah dan ditempatkan rekaman kedua pada posisi pertama dalam daftar baru. Apabila data kedua lebih besar, maka rekaman kedua ditempatkan pada posisi kedua dalam daftar baru.

-         Langkah-langkah berikutnya, rekaman demi rekaman disisipkan pada posisi yang sesuai dalam daftar baru yang dibangun itu.

Metode ini dapat diterapkan pada struktur data larik maupun rantai

Contoh penggunaan metode sisipan (lihat halaman berikutnya):

I

A(I)

Lewatan ke-

1

2

3

4

5

6

7

8

9

1

3

3

3

3

3

3

3

3

3

1

2

11

11

4

4

4

4

4

4

3

3

4

11

6

5

5

5

5

4

4

6

11

6

6

6

6

5

5

5

11

9

7

7

6

6

9

11

9

8

7

7

7

11

9

8

8

8

11

9

9

1

11

Lebih efisien untuk selipkan suatu nilai pada tabel yang sudah terurut

4 Metode Shell

Metode sorting ini merupakan perluasan dari metode sisipan. Dalam hal ini, pembandingan rekaman bukan dengan rekaman yang berdekatan, tetapi pada rekaman dengan spasi tertentu misalnya babak pertama 5 spasi, babak kedua 2 spasi dan babak terakhir 1 spasi. Penentuan besar spasi pada setiap babak pengulangan tidak dilakukan berdasarkan suatu algoritma tertentu, karena memang tidak ada algoritma untuknya.

Sorting data dengan metode ini mungkin akan gagal apabila pemilihan spasi tidak cocok.

Ilustrasi metode shell (lihat halaman berikutnya):

3

11

4

6

5

9

7

8

1

Babak I

3

7

4

1

5

9

11

8

6

Babak II

3

7

4

1

5

9

11

8

6

3

1

4

7

5

8

6

9

11

Babak III

3

1

4

7

5

8

6

9

11

Hasil

1

3

4

5

6

7

8

9

11

5 Metode Cepat  (Quicksort)

Algoritmanya adalah sebagai berikut:

-         Seleksi suatu perkiraan nilai median dari elemen yang akan diurutkan

-         Larik ditelusuri, elemen dipertukarkan sampai larik terbagi menjadi dua bagian; elemen yang lebih besar daripada median, dan elemen yang lebih kecil atau sama dengan (?) elemen median.

-         Dua langkah di atas diulang pada tiap bagian yang memiliki lebih dari P elemen (sebaiknya P<10).

-         Setelah bagian-bagian cukup kecil, setiap bagian diurutkan dengan metode Bubble

Tagged as , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Both comments and pings are currently closed.

52 Comments

  • On March 8, 2010 at 4:04 pm blog-walk.com said

    Bookmark dolo ah… pengetahuan yang berbeda 16:04

  • On March 9, 2010 at 1:47 am blog-walk.com said

    nyoba kirim komentar siang-siang gini. 01:47

  • On March 9, 2010 at 7:46 am nayantaka | technology news said

    Mencari pencerahan di rumah sahabat, berkelana di ladang ilmu 07:46

  • On March 10, 2010 at 6:46 am blog-walk.com said

    Kira-kira bisa bikin posting sebagus ini gak ya? 23:46 blog walking plugin can be downloaded blog-walk.com

  • On March 10, 2010 at 9:47 am nayantaka | technology news said

    jreng-jreg,…
    saya mau numpang majang dulu 02:47

  • On March 13, 2010 at 3:45 pm Techcastia said

    mencari update terbaru 08:45

  • On March 14, 2010 at 10:08 pm Autoblog and Blog Walking said

    Artikelnya keren banget … info bagus banget :) 15:08 blog walking plugin can be downloaded blog-walk.com

  • On March 19, 2010 at 2:38 pm Autoblog and Blog Walking said

    Artikelnya keren banget … info bagus banget :) 07:38 blog walking plugin can be downloaded blog-walk.com

  • On March 19, 2010 at 2:55 pm Autoblog and Blog Walking said

    Ada lagi gak yang bagus seperti ini . 07:55 blog walking plugin can be downloaded blog-walk.com

  • On March 23, 2010 at 9:38 am Autoblog and Blog Walking said

    Salam kenal …. saya senang melihat-lihat blog anda blog walking plugin can be downloaded blog-walk.com

  • On November 1, 2010 at 8:22 am hendra said

    cuma algoritma aja ya?
    koding nya ga ada?

  • On November 15, 2010 at 8:07 am arie said

    tolong dong informasi kelebihan dan kekurangan dari masing2 metode itu dan kasih contong source code

  • On September 6, 2011 at 5:31 pm Wholesale Galvanni said

    An awesome blogpost, I simply given this onto trainees who had previously been performing a little analysis on that. Anf the husband the fact is bought me breakfast because I stumbled upon it for him. :) .. So ok, i’ll reword that: Information treat! But yeah Thank you spending some time to go over this, I feel strongly over it and get learning much more about this topic. If possible, since you gain expertise, could you mind updating your website with additional details? It is very helpful for me. Big thumb up in this post!

  • On September 13, 2011 at 3:28 am link building services said

    increase low sperm count the length of time to cultivate sperm sperm production process increase sperm count and motility more sperm when ejaculating how to increase seminal production vitamins to extend sperm fertility produce more sperm without pills sperm motility test ejaculate lacking erection improve sperm taste increasing sperm fertility what vitamins increase sperm ejaculate harder natural ways to improve sperm count how to boost the amount you ejaculate vitamins to enhance sperm quality the best way to improve ejaculation time how do you raise the amount i ejaculate ejaculate without erection how to improve ejaculation distance best sperm count improve sperm count morphology sperm improve low sperm count successes sperm gain male sperm problems human sperm production rate increasing ejaculation fluid foods that increase sperm load

  • On September 15, 2011 at 4:31 am shirts and apparel said

    Abnormal this publish is totaly unrelated to what I was searching google for, but it used to be indexed on the first page. I guess your doing something right if Google likes you enough to place you on the first page of a non comparable search.

  • On September 16, 2011 at 1:00 pm California Web Design said

    Deference to op , some great selective information .

  • On September 27, 2011 at 4:59 pm Anton Lotto said

    Hello! I simply would like to give an enormous thumbs up for the great information you could have right here on this post. I will probably be coming back to your blog for extra soon.

  • On September 27, 2011 at 7:46 pm Zelda Piccolomini said

    I’m impressed, I have to say. Really hardly ever do I encounter a blog that’s each educative and entertaining, and let me inform you, you could have hit the nail on the head. Your concept is excellent; the problem is something that not enough persons are speaking intelligently about. I’m very glad that I stumbled across this in my search for one thing regarding this.

  • On September 28, 2011 at 3:26 pm Bennett Ibdah said

    Whats up! I simply want to give a huge thumbs up for the great information you have here on this post. I will be coming again to your weblog for more soon.

  • On September 30, 2011 at 4:10 pm Shayne Renova said

    I simply want to mention I’m newbie to blogs and truly savored your web blog. Probably I’m want to bookmark your blog post . You certainly come with very good posts. Appreciate it for sharing with us your web-site.

  • On October 2, 2011 at 2:54 am jokeripokeri said

    Excellent issues?I’d notice that as somebody who truly doesn’t write on blogs much (if truth be told, this can be my first publish), I don’t assume the term ‘lurker’ is very turning into to a non-posting reader. It’s not your fault in the slightest degree , but most likely the blogosphere may come up with a greater, non-creepy title for the 90% folks that experience reading the content material .

  • On October 2, 2011 at 4:55 am fast cash loans said

    Thank you for making the trustworthy try to provide an explanation for this. I feel very robust approximately it and wish to learn more. If it’s OK, as you reach extra in depth wisdom, would you mind including extra posts similar to this one with more information? It will be extremely helpful and helpful for me and my colleagues.

  • On October 2, 2011 at 2:15 pm no fax payday loans said

    I have been studying your entries right through my morning holiday, and I will have to admit the entire article has been very enlightening and rather well written. I believed I might allow you to realize that for a few reason why this weblog does not view well in Internet Explorer 8. I desire Microsoft could prevent changing their software. I’ve a question for you. Would you thoughts changing weblog roll hyperlinks? That would be truly neat!

  • On October 2, 2011 at 5:27 pm spel said

    Ordinary this put up is totaly unrelated to what I was searching google for, nevertheless it used to be indexed at the first page. I assume your doing something right if Google likes you adequate to place you on the first page of a non similar search.

  • On October 2, 2011 at 5:29 pm free Puzzles said

    Atypical this submit is totaly unrelated to what I used to be looking google for, but it surely was listed at the first page. I assume your doing something right if Google likes you enough to place you on the first web page of a non similar search.

  • On October 3, 2011 at 4:39 pm blog list said

    Im getting a browser error, is other people? When are you going to post again? You actually inform many people! Cheers with this short article, it had become great to learn. Appreciate the efforts you cash in on in writing this post. Im hoping a similar appropiate product by you in the foreseeable future too. Actually your creative writing abilities has inspired me to start my very own BlogEngine blog now. The blogging is spreading its wings rapidly. Your article can be a fine illustration showing it.

  • On October 3, 2011 at 11:41 pm baltimore cruises said

    “The way to love anything is to realize that it may be lost.” ~ Gilbert K. Chesterton

  • On October 4, 2011 at 2:13 am absolutely free web directory said

    Free web directory to get your site higher in search engies

  • On October 4, 2011 at 4:39 am Carisa Tsukamoto said

    Hello there, just discovered your blog on Yahoo, and found that it’s really baller. I am gonna watch out for diamonds. I’ll be grateful if you keep on writing about this topic later on. A lot of students will benefit from your posting. Take care!

  • On October 4, 2011 at 5:15 pm Mauro Battey said

    July 3 in the Citrus Bowl in Orlando – 4 PM to 9 PM. Public invited. Invitational*

  • On October 5, 2011 at 1:23 am find url from text said

    Beautiful essay, got the pleasure of reading

  • On October 5, 2011 at 2:01 am sub sandwich franchises said

    This really is so typical, I can not feel individuals are doing this but whatever

  • On October 5, 2011 at 3:16 am mantar hastalığı said

    Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but instead of that, this is great blog. A great read. I will definitely be back.

  • On October 5, 2011 at 11:41 am wedding planning timeline said

    Seeing this page I am sure that i may well know from college, did happen to go to Texas Technical? If you ever did remember to blast myself an email so we can easily catch up it’s been several years! Look forward to speaking with you and wish all will be well with you.

  • On October 6, 2011 at 7:25 am free online casino games said

    You will get really rich soon brilliant pidgeon makers. I mean you create a lot of brilliants.Just have to sell them and youll be rich in no time.

  • On October 6, 2011 at 2:10 pm car loans said

    Intriquing, notable and informative. But do you want to discuss this blog more? I can’t quite remember what he was selling.

  • On October 7, 2011 at 1:41 am v-pills said

    Great beat ! I wish to apprentice while you amend your web site, how could I subscribe for a blog web site? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear idea

  • On October 7, 2011 at 8:06 am Best Horror Movies said

    The Giants and their fans deserve better than that kind of incompetence.

  • On October 7, 2011 at 11:05 pm oyun download said

    Excellent blog here! Also your website loads up fast! What host are you using? Can I get your affiliate link to your host? I wish my site loaded up as quickly as yours lol

  • On October 8, 2011 at 4:00 am sex hikayeleri said

    This is very interesting, You are a very skilled blogger. I have joined your feed and look forward to seeking more of your great post. Also, I have shared your website in my social networks!

  • On October 8, 2011 at 8:49 am cho thue may phat dien said

    I’m impressed, I must say. Really hardly ever do I encounter a blog that’s both educative and entertaining, and let me inform you, you’ve gotten hit the nail on the head. Your idea is excellent; the issue is something that not sufficient persons are speaking intelligently about. I’m very completely satisfied that I stumbled across this in my search for something relating to this.

  • On October 8, 2011 at 9:19 am chase.com said

    You mentioned something in your post that we talked about some time ago. It was the beginning of the discussions surrounding Sabeans falied farm system to develop any impact position players. Until Sandoval, there had been no impact position players come out of the Giants system since Sabean came to the Giants as an assistant to Bob Quinn in the mid 90s. And even Sabean was taken by surprise, saying as late as the end of March, that he wasnt sure if Sandoval would make the team or not, but that Aurillia and Burris were sure things.

  • On October 8, 2011 at 8:56 pm jokeripokeri said

    Thanks for making the trustworthy attempt to provide an explanation for this. I feel very robust about it and wish to learn more. If it’s OK, as you reach more extensive knowledge, might you mind adding more posts very similar to this one with additional information? It will be extraordinarily useful and helpful for me and my colleagues.

  • On October 8, 2011 at 9:10 pm fast payday loans said

    I feel that may be an enchanting aspect, it made me think a bit. Thank you for sparking my thinking cap. Infrequently I get such a lot in a rut that I just really feel like a record.

  • On October 8, 2011 at 10:54 pm telephone answering service said

    I couldn’t get some of your links to work. Like your rss link just sent me back to your index page.

  • On October 8, 2011 at 11:30 pm no download Bingo said

    Thanks for making the honest try to explain this. I feel very strong about it and want to learn more. If it’s OK, as you reach extra in depth knowledge, would you thoughts adding extra posts similar to this one with additional information? It will be extraordinarily useful and useful for me and my colleagues.

  • On October 8, 2011 at 11:42 pm American poker said

    Thanks for making the trustworthy effort to talk about this. I believe very robust about it and would like to read more. If it’s OK, as you acquire more in depth knowledge, would you mind including extra articles similar to this one with more information? It would be extremely useful and helpful for me and my friends.

  • On October 9, 2011 at 4:17 am Clark Gillings said

    I couldn’t resist commenting

  • On October 9, 2011 at 3:28 pm windows games said

    I admire the valuable knowledge you offer in your articles. I will be able to bookmark your blog and feature my children check up right here generally. I’m quite sure they are going to be informed a variety of new stuff here than any one else!

  • On October 9, 2011 at 5:11 pm Reyna Hiraldo said

    I in addition to my buddies appeared to be checking the nice pointers found on your site while before long I got a terrible feeling I had not thanked you for those strategies. The boys were totally glad to learn all of them and have in effect seriously been taking pleasure in those things. Appreciation for indeed being well helpful and also for having this kind of incredible things most people are really wanting to discover. Our own honest apologies for not saying thanks to you earlier.
    http://www.photography-camera.biz

  • On October 10, 2011 at 12:29 am Marty Genier said

    You made some decent points there. I looked on the internet for the issue and found most individuals will go along with with your website.
    http://www.perfumefor.net

  • On October 10, 2011 at 5:12 am Florentina Hallisey said

    Following Feng Shui principles will assist you in forming the correct decisions about everything from furniture placement to light systems, Wash Sale Rule, 595271, Military Pay Chart, ardwg, Pittsburgh International Airport, 093470, Pimp Myspace Profile, nfksbr, All Nippon Airlines, tndzmi, Associated Wholesale Grocers, %))), African Methodist Episcopal, 8647, The Lions Den, =[[, Our Man In Havana, lbxwt, Nothing Gold Can Stay, %(((, South Seas Island Resort, >:-]]], Indianapolis Public Schools, 030166, Boot Camp Workouts, 48184, St Cloud Minnesota, riwi, Half Moon Bay, wbz, Pitbulls For Sale, yisq, Shasta Regional Medical Center, 8-[, Pearl Jam Ten, rcqzz, Phoenix Country Club, %-PP, The Paradies Shops, :( , Museum Of Anthropology, 45895, Jeff Dunham Comedy Central, 751, Suntrust Mortgage Inc, 8-), The Klondike Gold Rush, 312, Blue Ridge Numerics, ijh, Heli Attack 2, igwl, Morris Knolls High School, 0123, Watch Smallville Free, 7846, Working In Dubai, 744057, Intel Pro Wireless, ywdu, Led Holiday Lights, 8-DD,

Pingbacks / Trackbacks

Welcome to EdyWinarno.Com
Edy Winarno-Blogger-Author sekaligus dosen di Program Studi Teknik Informatika Universitas Stikubank (UNISBANK) Semarang. Penulis adalah alumnus S2 Sistem Komputer & Informatika - Teknik Elektro UGM Yogyakarta. Saat ini sedang melanjutkan studi S3 dengan beasiswa BPPS di Program Studi Ilmu Komputer UGM. Penulis bisa dihubungi di edy_winarno[at]yahoo.co.id



Edy Winarno

Create Your Badge

Tulis Pesan Anda