47,438 questions
4 votes
2 answers
122 views
Algorithm to recursively search a dictionary or list and return the path of each found element
I keep almost solving this. I've got a data set of python dictionaries that contain both lists and dictionaries that also contain lists and dictionaries. I want to find all instances of a substring in ...
-3 votes
0 answers
85 views
Why won't this recursive function return true [closed]
public static boolean isWordSymmetric(String[] words, int start, int end){ if (words[start].toLowerCase().equals(words[end - start].toLowerCase())) { if (start == end){ ...
3 votes
2 answers
156 views
Recursive C function for creating number permutations
I do understand I have mistakes in this code #include <stdio.h> #include <stdlib.h> #include <string.h> int diziyi_yazdır(int dizi[], int dizi_uzunluğu) { for (int i ...
-2 votes
1 answer
175 views
Why does my Quick Sort implementation sometimes cause stack overflow on large arrays with duplicates? [closed]
I’m trying to implement an in-place Quick Sort in Python. I have two slightly different versions of my partitioning logic, and I’m confused because both seem correct on small arrays, but the second ...
2 votes
1 answer
115 views
How to write an accumulative recursive function in J without looping
At the risk of asking a question with an obvious solution: if I have a function in J that takes two arguments and returns two arguments and I want to accumulate the answer's second argument and to use ...
3 votes
3 answers
85 views
How does the recursion in generateParenthesis go from backtrack(3, 3) to backtrack(2, 1)?
I am working on LeetCode problem 22. Generate Parentheses using a recursive backtracking approach in Python. The function works, but I’m having trouble understanding the flow of recursion, ...
1 vote
2 answers
151 views
How exactly does recursion work in x86 assembly?
My question is focused specifically on assembly (intel). In C for example, recursion can be done with a simple return command but in assembly I feel like there's a lot more things going on, especially ...
0 votes
1 answer
87 views
How to disable radio button on all levels in a recursive Angular form component based on a specific level's value
this is kind of a continuation of an improved version of an old question of mine so basically I have a recursive Angular form and I’m using to manage a folder hierarchy. Each folder has a radio button ...
1 vote
2 answers
146 views
Given the string input, how can we traverse the binary tree recursively
Let's say our binary tree (bt) looks like this: Node* root = new Node(); root->left = new Node("B"); root->right = new Node(); root->right->right = new Node("A");...
-1 votes
2 answers
165 views
Why does python limit recursion depth, and how is this limit decided?
# Iterative factorial function to safely compute very large factorials without hitting Python's recursion limit. # Recursive functions have a maximum depth, usually 1000, and factorial(2000) would ...
2 votes
1 answer
104 views
Sequential compilation times of a jax-jitted recursive function
I have a recursively defined function my_func that is jitted using jax.jit from the jax library. It is defined below: # Imports import jax import jax.numpy as jnp from functools import partial import ...
0 votes
1 answer
67 views
JQ will not deep copy arrays with recursive algorithm
When using this algorithm: jq -s 'def deepmerge(a;b): reduce b[] as $item (a; reduce ($item | keys_unsorted[]) as $key (.; $item[$key] as $val | ($val | ...
0 votes
1 answer
34 views
Display tree depth using VLT recursion
I'm trying to render a tree structure using VLT, by indenting the rendering depending on the level it's on. I tried to use a recursive macro which passes on the $indentLevel variable (see code below). ...
1 vote
2 answers
91 views
XML with attributes to array in PHP
I am trying to convert an XML string into multi-dimensioned PHP array. The difficulties are that XML comes with attributes and has nested values. My code works at parent level data but I am not sure ...
0 votes
0 answers
157 views
Stop Condition for Self-Referential Marcos
Background I am on an ARM Cortex-A72. To access bit fields of my core's system registers I use a macro code generation mechanism. For the sake of simplicity, I replaced void operator=(const uint64_t v)...