Pert3 Flashcards

1
Q

What is binary tree?

A

a data structure which is defined as a collection of elements called the nodes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Prefix notation dikenal juga?

A

Reverse polish notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

postfix notation dikenal juga?

A

polish notation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Depth first search?

A

sebuah algoritma untuk traversing atau searching dalam sebuah tree atau graph. Dimulai dari root dari sebuah tree dan melakukan explore sedalam mungkin pada setiap cabang sebelum ke cabang yang sebelahnya.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Depth first search (DFS) menggunakan data structure?

A

Stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Breadth first search (BFS) menggunakan data structure?

A

Queue

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Several applications using queue?

A
  1. Deques
  2. Priority Queue
  3. Breadth First Search
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Deque?

A

dapat di delete / insert dari head atau tail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

2 jenis Deque

A
  1. Input restricted deque
    insertion can be done only at one of the dequeue, deletions both the end
  2. Output restricted deque
    deletions can be done only at one of the dequeue, insertions both the end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Priority Queue?

A

sebuah ADT dimana setiap element diberikan sebuah prioritas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Breadth First Search (BFS)

A

sebuah algoritma untuk traversing atau searching dalam sebuah tree. dimulai dari root dan melakukan explore ke semua node yang bersebelahan dari level per level sampai menemukan hasil yang diinginkan

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Breadth First Search (BFS)

A

sebuah algoritma untuk traversing atau searching dalam sebuah tree. dimulai dari root dan melakukan explore ke semua node yang bersebelahan dari level per level sampai menemukan hasil yang diinginkan

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

3 arithmetic notations?

A
  1. Prefix, operator duluan sebelum operands
  2. Infix, operator diantara operands
  3. Postfix, operator setelah operands
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

if TOP = MAX - 1

A

stack is full

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

why do we need prefix/postfix notation?

A
  1. prefix and postfix notation don’t need brackets to prioritze operator precedence
  2. prefix and postfix is much easier for computer to evaluate
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

complexity dari infix expression?

A

O(N^2), N adalah panjang string

17
Q

Complexity dari Postfix expression?

A

O(N)

18
Q

algoritma postfix notation?

A
  1. jika operand push ke stack

2. jika operator, pop twice (store ke var A dan B) dan push(B operator A)

19
Q

Prefix notation pake stack scan dari mana ke mana?

A

kanan ke kiri

20
Q

algoritma convertion prefix ke postfix

A
  1. cari operator dengan precedence paling tinggi
  2. put operator behind the operand
  3. repeat until finish
21
Q

conversion infix to postfix notation complexity?

A

O(N)

22
Q

algoritma infix ke prefix

A
  1. cari operator dengan highest precedence
  2. put that operator before operand
  3. repeat until finish