double ended queue

May 30th, 2009 | Posted by
Contoh Double Ended Queue

Contoh Double Ended Queue

ciri2 double ended queue :

  1. kosong : L = R + 1
  2. penuh kanan : R = n – 1
  3. penuh kiri : L = 0
  4. penuh kanan dan kiri : R = n – 1 && L = 0
  5. bisa diisi dari kanan : R < n
  6. bisa diisi dari kiri : L > 0
  7. ada isinya : L < R + 1

kondisi awal :

L = 0;
R = -1;

algoritma dasar double ended queue :

  1. INSERT KANAN
    R = R + 1;
    Q[R] = X;
  2. INSERT KIRI
    L = L - 1;
    Q[L] = X;
  3. DELETE KANAN
    X = Q[R];
    R = R - 1;
  4. DELETE KIRI
    X = Q[L];
    L = L + 1;

Read more…

Tags:

circular queue

May 30th, 2009 | Posted by
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--;

Read more…

Tags:

double stack

May 30th, 2009 | Posted by
Contoh Double Stack

Contoh Double Stack

ciri2 double stack :

  1. stack 1 kosong : top1 = -1
  2. stack 2 kosong : top2 = n
  3. stack penuh (stack 1 dan stack 2 tidak bisa diisi) : top2 – top1 = 1
  4. stack bisa diisi (stack 1 dan stack 2 tidak bisa diisi) : top2 – top1 > 1
  5. stack 1 ada isinya : top1 > -1
  6. stack 2 ada isinya : top2 < n

kondisi awal :

top1 = -1;
top2 = n;

algoritma dasar double stack :

  1. PUSH stack 1
    top1 = top1 + 1;
    s[top1] = x;
  2. POP stack 1
    x = s[top1];
    top1 = top1 - 1;
  3. PUSH stack 2
    top2 = top2 - 1;
    s[top2] = x;
  4. POP stack 2
    x = s[top2];
    top2 = top2 + 1;

Read more…

Tags:

single stack

May 30th, 2009 | Posted by
Contoh Single Stack

Contoh Single Stack

ciri2 single stack :

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

kondisi awal :

top1 = -1;

algoritma dasar single stack :

  1. PUSH
    top = top + 1;
    s[top] = x;
  2. POP
    x = s[top];
    top = top - 1;

Read more…

Tags:

testing syntax-highlighter-and-code-prettifier

May 27th, 2009 | Posted by

kali ini coba plugin syntax highlighter and code prettifier :
java :

public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}

ruby :

class Example
  def example(arg1)
    return "Hello: " + arg1.to_s
  end
end

hasilnya sama saja. code php tetep gagal tampil.

Tags:

testing wp-syntax

May 25th, 2009 | Posted by

hanya coba2 untuk liat kinerja plugin wp-syntax :
java :

public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello World!");
  }
}

ruby :

class Example
  def example(arg1)
    return "Hello: " + arg1.to_s
  end
end

dan ternyata terdapat masalah jika kita gunakan php.

source :
http://wordpress.org/extend/plugins/wp-syntax/other_notes/

Tags: