46. Permutations      Permutation of the distinct elements in an Array.
Channel: bab lobko
Date: 07/11/2022

Permutation of the distinct elements in an Array. We are going to solve the classical problem of permuting the distinct elements of the given array.
This solution employs the typical backtracking approach, to generate the elements. Backtracking is selective refined brute force. We selectively traverse the State space tree, the state is characterised by the partial solution. The State space tree is a way of representing the initial starting position (the root node) and a final goal state (one of the leaves).
The  partial solution vector is built at each depth component wise and is passed as an argument to the recursion call, and in each call we augment the partial solution. Hence the partial solution is what is maintaining the state of the backtracking recursive calls. These recursive calls are exploratory in nature. As we all know recursion is suited for these kind of explorations.