Algorithm study notes

Tree:

https://www.cs.cmu.edu/~adamchik/15-121/lectures/Trees/trees.html

 

Backtrack:

A general recursive template for backtracking:

   helper (parameters of given data and current recursive level) {
        // Handle base cases, i.e. the last level of recursive call
        if (level == lastLevel) {
            record result;
            return sth;
        }
        // Otherwise permute every possible value for this level.
        for (every possible value for this level) {
            helper(parameters of given data and next recursive level);
        }
        return sth;
    }

 

About the Author

admin

Leave a Reply

Your email address will not be published. Required fields are marked *