Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 06-20-2013, 12:11 AM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Programming › C / C++ v
« Previous 1 ... 7 8 9 10 11 ... 15 Next »

bubble sort algorithm

Home General Computer Multimedia Business Lounge

Pages (2): « Previous 1 2
Post Reply 
Tweet
Threaded Mode | Linear Mode
bubble sort algorithm
01-04-2012, 11:59 PM
Post: #11
ketek Offline
bocah ingusan
*******
Administrators
Posts: 2,317
Joined: Jan 2010
Reputation: 410
RE: bubble sort algorithm
maaf om,, pake borland c++ ya om, gede banget package nya ...mau download kelamaan om dead
ane pake itu aja bisa kok ketawa

tapi kok klo pake array --> { 4, 3, 2, 1, 5 }
dia gak mau ngurut kenapa ya om syn_attack malu

[Image: 727xqo.jpg]
Find all posts by this user
Quote this message in a reply
01-05-2012, 12:03 AM
Post: #12
syn_attack Away
execl("/bin/sh", "sh", NULL);
**
Moderators
Posts: 308
Joined: Sep 2011
Reputation: 55
RE: bubble sort algorithm
kakak ketek ~# maaf kakak kalau aku tanyanya nggak sopan.... kompiler kakak ketek pake apa kakak???? nanti aku modif itu kodenya biar bisa di kompiler kakak ketek..... wawa
Visit this user's website Find all posts by this user
Quote this message in a reply
01-05-2012, 12:12 AM (This post was last modified: 01-05-2012 12:19 AM by ketek.)
Post: #13
ketek Offline
bocah ingusan
*******
Administrators
Posts: 2,317
Joined: Jan 2010
Reputation: 410
RE: bubble sort algorithm
pake codeblock, masalahnya bukan di compiler om,, di algoritmanya om paulus ada yg kurang ketawa

coba baca lagi pertanyaan ane yg di post seblumnya
Quote:truz itu variable swap_value, kok gak digunakan?
kalo gitu algo "repeat - until not swapped" dari pseudocode blum masuk di kode om paulus

ketawaketawa


klo gak percaya, coba om paulus sorting array ini -> { 4, 3, 2, 1, 5 }
Find all posts by this user
Quote this message in a reply
01-05-2012, 02:02 PM
Post: #14
syn_attack Away
execl("/bin/sh", "sh", NULL);
**
Moderators
Posts: 308
Joined: Sep 2011
Reputation: 55
RE: bubble sort algorithm
kakak ketek ~# o iya iya kakak, kalau index nomor 1 lebih besar dari index nomor 2 kok tidak tertukar ya kakak.... malu

iya udah dech kakak, nanti aku betulin lagi dech kakak ketek, terimakasih ya kakak ketek atas sarannya...... hore
Visit this user's website Find all posts by this user
Quote this message in a reply
01-05-2012, 02:24 PM
Post: #15
ketek Offline
bocah ingusan
*******
Administrators
Posts: 2,317
Joined: Jan 2010
Reputation: 410
RE: bubble sort algorithm
iya karena kamu cuma sorting sekali jalan saja

Code:
for (i = 1; i < array_length; i++) {
       if (array_state[i - 1] > array_state[i]) {
          temp = array_state[i];
         array_state[i] = array_state[i - 1];
         array_state[i - 1] = temp;
         swap_value = true;
      }
   }

tanpa di compile pun itu udah keliatan salahnya omz ketawa

kan udah ane ingatkan om... itu ada yg kurang dari algo nya
Code:
procedure bubbleSort( A : list of sortable items )
  repeat
    swapped = false
    for i = 1 to length(A) - 1 inclusive do:
      if A[i-1] > A[i] then
        swap( A[i-1], A[i] )
        swapped = true
      end if
    end for
  until not swapped
end procedure

jadi harusnya for loopnya juga looping sampai sortingnya selesai, kyk gini, coba liat, sama gak sama yg pseudocode nya? ketawa
Code:
do{
        swap_value = false;
       for (i = 1; i < array_length; i++) {
           if (array_state[i - 1] > array_state[i]) {
              temp = array_state[i];
             array_state[i] = array_state[i - 1];
             array_state[i - 1] = temp;
             swap_value = true;
          }
       }
    }while(swap_value);

selamat belajar paulus mantap
Find all posts by this user
Quote this message in a reply
01-05-2012, 03:38 PM
Post: #16
syn_attack Away
execl("/bin/sh", "sh", NULL);
**
Moderators
Posts: 308
Joined: Sep 2011
Reputation: 55
RE: bubble sort algorithm
kakak ketek ~# o iya iya kakak aku lupa, terimakasih kakak ketek sudah membetulkan...... hore

# jadi punya bahan belajar lagi dech..... #
Visit this user's website Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Pages (2): « Previous 1 2
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Thumbs Up [Tutor] Program Urutkan Data dengan metode insertion sort chentiz 4 167 12-10-2012 10:18 PM
Last Post: chentiz
  merge sort ack_attack 4 438 03-28-2012 09:36 PM
Last Post: RieqyNS13
  binary search algorithm syn_attack 5 573 01-04-2012 04:08 AM
Last Post: Bunga.Mataharry
  Message Digest-5 Algorithm in C syn_attack 15 1,287 10-29-2011 10:41 PM
Last Post: syn_attack

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 06-20-2013, 12:11 AM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE