Assume all 3 process has same implementation of code except flag variable indices changes accordingly for Pj and Pk and turn is shared variable among 3 process.
Initially Flag[i]=F,Flag[j]=F,Flag[k]=F and assume turn =i
1)Let Pi and Pk want to enter CS then set Flag[i] =T and Flag[k]=T
2)Pi will enter CS while Pk will wait because case turn =j is true and flag[i]=T,it will wait till turn =k therefore Mutual exclusion is satisfy other process agree to wait
3)here if initially turn =j then both Pi and Pk will wait even when no process in CS.