All Questions
Tagged with recursion performance
155 questions
3
votes
1
answer
168
views
Pentomino solver in Python
When I was a child, I used to play Ubongo board game, recently I discovered Pentomino puzzle and I wanted to create a custom solver in python for it. Here is what I got:
...
2
votes
3
answers
553
views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
5
votes
2
answers
675
views
Recursively calculating powers by squaring
Consider the following function that implements optimised O(log n) exponentiation by squaring:
...
2
votes
1
answer
96
views
Find all non-crossing tuples which has the same content with a given tableau
Let T be a semistandard Young tableau of rectangular shape. For example,
[[1,2,4],[3,5,6]]
is such a tableau, where [1,2,4] and [3,5,6] are columns. All non-...
4
votes
1
answer
80
views
Optimising compatibility-conflict graph solution - python recursive routine
Background
I'm implementing an algorithm which localises overlapping sound sources using the time-difference-of-arrivals across 3 sensors [1]. Compatible 'triples' (e.g. with only 2 common sensors) ...
2
votes
1
answer
89
views
Locate Primitive Value in Nested Sequence Type - Iterative version is slower than equivalent recursive function
I'm looking for advice on how to improve the performance and/or style of these two search functions. This is just for fun and for practice: they are already fast enough for any application I would ...
1
vote
2
answers
110
views
Binary Search using recursive approach
Is the following implementation of recursive function correct? How about the time complexity of the code; is it good in terms of performance?
...
0
votes
1
answer
83
views
PHP game - changing color of cells in a blue and white grid => updating groups of white cells that touch each other
My game is a grid in which you have to change cells color by clicking on them. When I generate a grid I have to know all the possible combinations of blue and white cells my game allows, to know the ...
2
votes
1
answer
77
views
Recursion to generate fractal
I used recursion to generate fractal and got the desired result but I think my code can be better
I started using MATLAB a few days ago and since than trying and learning new things.
Now this code ...
0
votes
1
answer
103
views
Recursive function that gives the number of hashes present in a Merkle Mountain Range proof
I have written a function that gives the number of hashes present in a Merkle Mountain Range proof. Using Solidity, this function can be written as:
...
3
votes
2
answers
555
views
Asynchronous and recursive word square generator in C#
Overview
I've created an asynchronous and recursive method of generating word squares, of any size (known as the order of the square), from a known word list. If you're unfamiliar with word squares:
...
1
vote
1
answer
448
views
Recursively unpacking a javascript object
I'm seeing a React course, we were studying fundamentals of javascript for a while. We saw how to access the content of an object and display it in console. My solution for the problem of displaying ...
1
vote
0
answers
372
views
Codewars: Path Finder
Task
You are at position [0, 0] in maze NxN and you can only move in one of the four cardinal directions (i.e. North, East, South, West). Return true if you can reach position [N-1, N-1] or false ...
10
votes
1
answer
2k
views
Find all paths in a graph
My code does a DFS on the given graph and prints all possible paths for a given start and end node. My question is how can this be improved?
Can some form of memoization be used here? There are cases ...
5
votes
3
answers
1k
views
Separating the even and odd numbers in an array in C
I wrote a working program in C that takes an array with size 2ⁿ, and separates all the even numbers from the odd numbers.
For example: Input: {1,2,3,4,5,6,7,8}, Output: {8,2,6,4,5,3,7,1}
I want my ...