A recursive datastructure is a datastructure (e.g. a struct or class) that contains one or several references to instances of the same datastructure as a member.
Questions tagged [recursive-datastructures]
524 questions
5
votes
2 answers
Limited function calls in nodejs on same operation?
I am currently working on some scientific calculations for which my base calculation loops are executed over and over again with recursive calls as long as at least one parameter is false.
Currently my nodejs server stops at around 905 - 915th…

noa-dev
- 3,561
- 9
- 34
- 72
5
votes
2 answers
bifunctor in haskell after the least fixed type
I am not sure how to derive the functor instance after making a fixed point :
data FreeF f a next = PureF a | FreeF (f next) deriving (Functor)
data Mu f = In { out :: f ( Mu f ) }
newtype Free f a = Free( Mu (FreeF f a) )
instance Functor f…

nicolas
- 9,549
- 3
- 39
- 83
5
votes
2 answers
How do you update a QuadTree after an object has moved in C++?
The easiest method is removing and inserting the object, but there are probably faster methods. (If I'm overthinking this and I should just do it the simple way, let me know)
Here are some notes about my QuadTree
The objects that are moving are…

epitaque
- 73
- 3
- 9
5
votes
3 answers
Java Generics Type Safety warning with recursive Hashmap
I'm using a recursive tree of hashmaps, specifically Hashmap map where Object is a reference to another Hashmap and so on. This will be passed around a recursive algorithm:
foo(String filename, Hashmap map)
{
//some stuff here
…

GC.
- 53
- 1
- 3
5
votes
1 answer
Why must coq mutually inductive types have the same parameters?
Following Arthur's suggestion, I changed my Fixpoint relation to a mutual Inductive relation which "builds up" the different comparisons between games rather than "drilling down".
But now I am receiving an entirely new error message:
Error:…

dspyz
- 5,280
- 2
- 25
- 63
5
votes
2 answers
Operator[] Overloading in MultiDimensional Arrays c++
When I call: a7[0][1][100];
I am able to obtain the first index 0 in the operator[] but as index I won't able to obtain other index values 1 and 100 as recursively. How could I able to use operator[] in order to obtain recursive following index…

alper
- 2,919
- 9
- 53
- 102
4
votes
2 answers
How can I recursively insert the Fibonacci sequence into a binary tree
Hope someone can help, I'm not a programmer, but have been interested in exploring Fibonacci sequence and it's recursive tree...
I've created a Binary Tree class, along with an associated TreeNode class, and want to generate a binary tree of the…

Alex2134
- 557
- 7
- 22
4
votes
2 answers
Recursive data structures in haskell: prolog-like terms
I have a question about recursive data structures in Haskell (language that I'm currently trying to learn).
I would like to encode in Haskell Prolog-like terms, but every solution I came up with has different drawbacks that I would really like to…

Riccardo T.
- 8,907
- 5
- 38
- 78
4
votes
1 answer
Constructing an infinite, lazy Monad value recursively
As an exercise, I tried to construct an infinite, lazy list, recursively, inside a monad.
Basically, the equivalent of nat, but monadic, monat:
nat :: Int -> [Int]
nat n = n : nat (n+1)
monat :: Monad m => Int -> m [Int]
monat n = return n >>= \n…

Blue Nebula
- 932
- 4
- 9
4
votes
1 answer
Best way to build a network of Nodes from JSON to classes
I have a collection of elements that forms a net of measurements and are related in a recursive manner. I need to store them in a class of objects for storing in a Cassandra database. I have built the individual classes for creating each object.…

BreenDeen
- 623
- 1
- 13
- 42
4
votes
1 answer
How to initialize mutually recursive records in F#
I have two records that have a parent-child relationship:
type Parent =
{ Number: int
Child: Child }
and Child =
{ String: string
Parent: Parent }
I have tried initializing these using the following syntax, which doesn't work:
let rec…

cmeeren
- 3,890
- 2
- 20
- 50
4
votes
2 answers
jq recursively delete values that appear in array anywhere in schema
I'm trying to find out how to use jq to remove a certain value that occurs anywhere in the schema in an array.
In this case i'm trying to remove agent4 from anywhere inside an array underneath the field labelled agents.
This is what I have so far…
user8914241
4
votes
1 answer
Swift recursive enum enters infinite loop in constructor
I've created a recursive enum in Swift that compiles without errors or warnings, but which enters an infinite loop when I try to instantiate it:
enum Tree {
case Leaf(T)
case Branch(T, [Tree])
}
Tree.Leaf(0) // enters infinite…

exists-forall
- 4,148
- 4
- 22
- 29
4
votes
1 answer
jquery parse xml with unlimited child level category
I'm fairly new on parsing xml with jquery, so if my question looks like noobish, please forgive me.
I have an xml it contains my recursive categories. Some of them has sub categories, some of them not. It has some deep level categories under sub…

HddnTHA
- 1,041
- 3
- 19
- 38
4
votes
3 answers
'Default Behavior' for Haskell recursive data types
I'm trying to write a propositional logic solver in Haskell. I'm representing logical expressions with a recursive data type called 'Sentence' that has several subtypes for different operations - 'AndSentence', 'OrSentence', etc. So I guess it's a…

rwturner
- 43
- 4