Gantt chart:
Process

P1

P2

P2

P3

P3

P4

P1

Time(AT to CT )

0 to 2

2 to 3

3 to 6

6 to 8

8 to 12

12 to 17

17 to 27

Calculating average waiting time:
Process

Arrival time (AT)

Burst Time (BT)

Completion time (CT)

Turnaround time (TAT)

Waiting Time (WT)

P1

0

12

27

27

15

P2

2

4

6

4

0

P3

3

6

12

9

3

P4

8

5

17

11

4

Average waiting time \(= \frac{{15\; + \;0\; +\; 3\; + \;4}}{4} = \frac{{22}}{4} = 5.5\)
Hence 5.5 is the correct answer.
Important Point:
TAT = CT – AT
WT = TAT – BT