Questions tagged [recursion]
Recursion in computer science is a method of problem solving where the solution to a problem depends on solutions to smaller instances of the same problem.
1,129 questions
1
vote
0
answers
33
views
A recursive_minmax Template Function with Unwrap Level Implementation
This is a follow-up question for A recursive_minmax Template Function Implementation in C++ and A recursive_flatten_view Template Function Implementation in C++. The ...
6
votes
1
answer
870
views
Python function that deeply "freezes" an object
I implemented a function that gets an object and returns its immutable counterpart. If the object contains another mutable object at any level, it freezes it too.
Is my code is good and/or can it be ...
5
votes
3
answers
957
views
LeetCode 678: Valid Parenthesis String, Recursion memoization to DP
How can the following recursion + memoization code be converted into a tabulation format dynamic programming solution?
The code is working, but I want to improve it.
The challenge I am facing is ...
5
votes
2
answers
117
views
Advent of Code 2015 "Not Quite Lisp", in Common Lisp
I've been toying around with random programming languages for about 15 years. I'm just more of a sysadmin type than a programmer, but I've always wanted to do programming, so here I am. I know a bit ...
6
votes
2
answers
188
views
Is this Python decorator a good idea to solve circular recursion?
I have several model classes, let's say A_0, A_1, ..., A_N
I have a method A_0.to_A_1() that calls A_1.to_A_2(), ... that calls ..., that calls A_(N-1).to_A_N()
So far so good, but A_N may then call ...
6
votes
2
answers
134
views
Check whether two Strings are anagrams of each other - then print all anagrams
I should write a CLI through which two Strings can be read in. These two Strings should be checked for whether they are anagrams of each other
For both Strings, I should give out all their possible ...
2
votes
1
answer
212
views
Pollard's rho algorithm implementation
I used std::multiset to determine how many times that factor appears.
I'd like to know if it can be improved; I've focused on the algorithm rather than the code.
...
2
votes
0
answers
37
views
A recursive_replace_copy_if Template Function with Unwrap Level Implementation in C++
This is a follow-up question for A recursive_replace_copy_if Template Function Implementation in C++. I am trying to implement recursive_replace_copy_if template ...
9
votes
3
answers
601
views
Form all possible well-formed strings of 'n' nested pairs of 2 types of ASCII brackets
Taking an interest in the challenge presented in this recent Code Review question, I've concocted a C solution (valid as C++, if I'm not mistaken) seeking to reduce both the lines of code and the ...
3
votes
1
answer
112
views
Recursively iterate over every object in an object graph looking for specific types
I have an object graph which contains two types of objects that I care about:
Link objects that contain an ID and a reference to the object with that ID.
...
3
votes
1
answer
59
views
A recursive_flatten_view Template Function Implementation in C++
This is a follow-up question for A recursive_flatten Template Function Implementation in C++. I am trying to follow G. Sliepen's answer to create ...
3
votes
1
answer
81
views
A recursive_flatten Template Function Implementation in C++
This is a follow-up question for A Summation Function For Boost.MultiArray in C++, A recursive_minmax Template Function Implementation in C++ and A recursive_reduce_all Template Function ...
1
vote
0
answers
46
views
recursive_remove_copy_if and recursive_remove_copy Template Functions Implementation with Execution Policy in C++
This is a follow-up question for recursive_remove and recursive_remove_if Template Function with Unwrap Level Implementation in C++. I am trying to implement ...
1
vote
1
answer
48
views
recursive_remove and recursive_remove_if Template Function with Unwrap Level Implementation in C++
This is a follow-up question for recursive_find and recursive_find_if_not Template Functions Implementation in C++ and A recursive_copy_if Template Function Implementation with Unwrap Level ...
4
votes
1
answer
109
views
A recursive_copy_if Template Function Implementation with Unwrap Level Implementation in C++
This is a follow-up question for A recursive_copy_if Template Function Implementation in C++ and recursive_invocable and recursive_project_invocable Concept Implementation in C++. I am trying to ...