Question: Expalin each step of psudo code berifly. function check_all_permutations(adj[][], n) for i = 0 to n p[i]=i while next permutation is possible valid = true
Expalin each step of psudo code berifly.
function check_all_permutations(adj[][], n)
for i = 0 to n
p[i]=i
while next permutation is possible
valid = true
for i = 0 to n-1
if adj[p[i]][p[i+1]] == false
valid = false
break
if valid == true
return true
p = get_next_permutation(p)
return false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
