Contoh Circular Queue
Contoh Circular Queue

ciri2 circular queue :

  1. kosong : counter = 0
  2. penuh : counter = n
  3. bisa diisi : counter < n
  4. ada isinya : counter > 0

kondisi awal :

f = 0;
r = -1;
counter = 0;

algoritma dasar circular queue :

  1. INSERT
       R = (R+1) % n;
       Q[R] = X;
       Counter++;
  2. DELETE
       X = Q[F];
       F =(F+1) % n;
       Counter--;

algoritma lengkap circular queue :

  1. INSERT
    void INSERT(void){
        if(Counter &lt; n){
            R = (R+1) % n;
            Q[R] = X;
            Counter++;
        }else{
            printf("antrian penuh");
        }
    }
  2. DELETE
    void DELETE(void){
        if(Counter &gt; 0){
            X = Q[F];
            F = (F+1) % n;
            Counter--;
       }else{
            printf("antrian kosong");
       }
    }

2 thoughts on “circular queue

  1. 1. what are some of your favorite sncaks??almonds, popcorn, and, lately, strawberries dipped in a drizzle of sugar-free chocolate syrup.2. What is your favorite way to exercise?I like all forms, but walking is my absolute favorite. It’s good exercise for the mind as well as the body. :) 3. What is on your kitchen counter, besides a kettle, that you use a lot??A jar of peanut butter and a basket of fruit. Beyond that, nothing.4. Do you keep track of the amount of water you drink per day?Not consistently, but if you’re going to nag about it… :) 5. If you were to tell someone one major thing that you do to help make you healthy what would it be?Don’t try to change everything at once, especially if you’re working on correcting a whole lifetime of bad habits. Always fun! Thank you!

    Reply
  2. Oh, I love this! What a great way to share info!1. What are some of your favorite snkcas? Almonds, Fage yogurt with frozen blueberries, hummus2. What is your favorite way to exercise? Biking outside3. What is on your kitchen counter, besides a kettle, that you use a lot? Coffee maker, Splenda, Spike, pepper, True Lemon shaker (I put lemon on everything!)4. Do you keep track of the amount of water you drink per day? Sort of, I use a 20 oz refillable bottle and try to keep track of how many I drink during the day5. If you were to tell someone one major thing that you do to help make you healthy what would it be? Exercise – pick one thing you love so you’ll stick with it.

    Reply

Leave a reply

required

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre user="" computer="" escaped="">