Skip to content

Latest commit

 

History

History
17 lines (9 loc) · 1.84 KB

README.md

File metadata and controls

17 lines (9 loc) · 1.84 KB

Common Recursive Algorithms

  • Subsets: A recursive algorithm that generates all possible subsets of a given set of elements. This can be done by including or excluding each element in the set.

  • Permutations: A recursive algorithm that generates all possible arrangements of a set of elements. This can be done by swapping elements in the set and generating permutations of the remaining elements.

  • Combinations: A recursive algorithm that generates all possible combinations of a set of elements of a given size. This can be done by choosing a fixed number of elements from the set and generating combinations of the remaining elements.

  • Subsequences: A recursive algorithm that generates all possible subsequences of a given sequence. This can be done by including or excluding each element in the sequence.

  • Subarray: A subarray is a contiguous (adjacent and uninterrupted) portion of an array, which means it is a subset of elements that are located consecutively in the original array. For example, if we have an array [1, 2, 3, 4, 5], then [2, 3, 4] is a subarray of it, but [1, 3, 5] is not a subarray because the elements are not adjacent in the original array.

  • Parenthesis combinations: A recursive algorithm that generates all possible combinations of opening and closing parentheses of a given length. This can be done by recursively adding opening or closing parentheses until the desired length is reached.

  • String permutations: A recursive algorithm that generates all possible permutations of the characters in a given string. This can be done by swapping characters in the string and generating permutations of the remaining characters.

  • Graph traversals: A recursive algorithm that explores all possible paths in a graph. This can be done by recursively visiting adjacent nodes and generating paths from the visited nodes.