IF2030_Proc_12_PohonBiner_bagian1

1 2011 2012 22 traversal post traversal post order

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lse { Rekurens, tidak kosong } tid InOrder(Left(P)) Proses(P) InOrder(Right(P)) 11/22/11 YA/IF2030/Sem. 1 2011-2012 22 Traversal Post Traversal – Post-order procedure PostOrder (input P : BinTree) { I.S. Pohon P terdefinisi } { F.S. Semua node pohon P sudah diproses secara PostOrder: kiri, kanan, akar } { Basis : Pohon kosong : tidak ada yang diproses } { Rekurens : Proses secara PostOrder (Left(P)); d Proses secara PostOrder (Right(P)); Proses Akar(P); } KAMUS LOKAL ALGORITMA if IsTreeEmpty(P) then { Basis-0 } { do nothing } else { Rekurens, tidak kosong } tid PostOrder(Left(P)) PostOrder(Right(P)) Proses(P) 11/22/11 YA/IF2030/Sem. 1 2011-2012 23 Tinggi/Kedalaman Pohon Tinggi/Kedalaman Pohon function Tinggi (R : BinTree) → integer { Pohon Biner mungkin kosong. Mengirim “height” yaitu tinggi dari pohon } { Basis: Pohon kosong: tingginya nol } { Rekurens: 1 + maksimum (Tinggi(Anak kiri), ki Tinggi(AnakKanan)) } KAMUS LOKAL ALGORITMA if IsTreeEmpty(P) then { Basis 0 } →0 else { Rekurens } → 1 + max (Tinggi(Left(R)), Tinggi(Right(R))) 11/22/11 YA/IF2030/Sem. 1 2011-...
View Full Document

This document was uploaded on 03/15/2014 for the course IF 2030 at Institut Teknologi Bandung.

Ask a homework question - tutors are online