1 / 16

# Binary Tree Traversal - PowerPoint PPT Presentation

Binary Tree Traversal. Definisi. Penelusuran seluruh node pada binary tree. Metode : Preorder Inorder Postorder. PreOrder Traversal. Preorder traversal Cetak data pada root Secara rekursif mencetak seluruh data pada subpohon kiri Secara rekursif mencetak seluruh data pada subpohon kanan.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' Binary Tree Traversal' - joshua

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Binary Tree Traversal

• Penelusuran seluruh node pada binary tree.

• Metode :

• Preorder

• Inorder

• Postorder

• Preorder traversal

• Secara rekursif mencetak seluruh data pada subpohon kiri

• Secara rekursif mencetak seluruh data pada subpohon kanan

b

c

Preorder Example (visit = print)

a

c

b

b

c

f

e

d

j

g

h

i

Preorder Example (visit = print)

a

b

d

g

h

e

i

c

f

j

+

*

e

f

+

-

a

b

c

d

Preorder Of Expression Tree

/

*

+

a

b

-

c

d

+

e

f

Gives prefix form of expression!

• Inorder traversal

• Secara rekursif mencetak seluruh data pada subpohon kiri

• Secara rekursif mencetak seluruh data pada subpohon kanan

b

c

Inorder Example (visit = print)

b

a

c

b

c

f

e

d

j

g

h

i

Inorder Example (visit = print)

g

d

h

b

e

i

a

f

j

c

• Postorder traversal

• Secara rekursif mencetak seluruh data pada subpohon kiri

• Secara rekursif mencetak seluruh data pada subpohon kanan

b

c

Postorder Example (visit = print)

b

c

a

b

c

f

e

d

j

g

h

i

Postorder Example (visit = print)

g

h

d

i

e

b

j

f

c

a

+

*

e

f

+

-

a

b

c

d

Postorder Of Expression Tree

a

b

+

c

d

-

*

e

f

+

/

Gives postfix form of expression!

Telusuri pohon biner berikut dengan menggunakan metode pre, in, post, dan level traversal.