Questions tagged [recursive-datastructures]

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.

524 questions
0
votes
2 answers

Converting List of lists to Stream - Functional Programming

I am working on Scala to convert list of lists to list of customized object "Point" class Point(val x: Int, val y: Int) { var cX: Int = x var cY: Int = y } Should I use Foreach or should I use Map or foreach in this case def…
DataT
  • 85
  • 1
  • 2
  • 7
0
votes
1 answer

GenericArguments[1], 'T', on 'BinaryNode`2[N,T]' violates the constraint of type parameter 'T'

What exactly is this error message complaining about? I'm trying to create a node class that can hold a value and point to other nodes, as well as be expanded to have more information embedded inside each of the nodes. The recursive templates are…
Curtor
  • 737
  • 2
  • 9
  • 17
0
votes
2 answers

Concatenate Data From URLS Recursively Inside one DataFrame

I'm trying to create one dataframe with data from multiple urls I'm scraping. The code works however I'm unable to store the data in one DataFrame recursively. The DataFrame (called frame) is replaced with a new url's data each time rather than…
0
votes
2 answers

Is it possible to make a recursive datatype in haskell that accepts more than one specific type?

Say for instance I want to make a list type that allows for flexible nesting like so: [[['a'],'a'],'a'] Would it be possible to implement this in haskell? How would I go about writing it's type signature? Any help would be awesome!!!
Athan Clark
  • 3,886
  • 2
  • 21
  • 39
0
votes
1 answer

List syntax with custom list type

Given a custom type of lists such as data List' a = EmptyList | NonEmptyList a (List' a) deriving Show and a function to tell if such a list is non-empty null' xs = case xs of EmptyList -> True _ -> False why doesn't calling it in…
0
votes
2 answers

Recursive call instead of multiple for loop calls C++

On the following example, with 5 loops I am able to obtain each individual index to access into multi dimensional array. Is there any way for dynamic systems if I don't know the dimension of the array, implement and recursive function to access the…
alper
  • 2,919
  • 9
  • 53
  • 102
0
votes
3 answers

Looping through recursive list in C

I've just started out with C and I think the whole pointers/malloc/free is driving me mad. I tried to define a simple linear recursive data structure and loop through it, printing each element that I've looped through. (Code as below). However, I'm…
Jon Gan
  • 867
  • 1
  • 11
  • 22
0
votes
1 answer

Defining variable for recursive data structure in C

I have a function sortbyName that returns a recursive data structure sortedList. sortList itself contains a pointer to another recursive data structure stud_type and they are all defined as below. typedef struct stud_type_ { int matricnum; …
Jon Gan
  • 867
  • 1
  • 11
  • 22
0
votes
2 answers

Why does this method cause an Infinite Recursive call?

I'm struggling to understand why this class is not functioning. It was part of an assignment for a course on Data Structures(EDIT: The deadline for the assignment has passed, I just want to figure it out...). The node is part of an AVL tree built…
0
votes
2 answers

Possible Bug in Migration for EF 6 Alpha 3 on recursive relationship?

I had to define a recursive relationship on a composite key. After much trials, I ended up with this: protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); …
BernardG
  • 1,956
  • 3
  • 17
  • 25
0
votes
2 answers

Recursive data structures going wrong - incompatible types when assigning List from type struct *l

I've made a binary tree where there are essentially three levels of structs: typedef struct l { char n[15]; struct l *next; } List; typedef struct { char rname[20]; char lname[20]; List number; } info; typedef struct tree { info…
Joe
  • 173
  • 3
  • 10
0
votes
1 answer

How to turn this PHP array structure into multi-dimensional tree?

I have a 2-dimensional PHP array which I need to turn in to a tree. The 'path' value in each inner-array is the enumerated path to the current node. (I got this idea from Bill Karwin's book on SQL Antipatterns). So, the array that I am starting…
DatsunBing
  • 8,684
  • 17
  • 87
  • 172
0
votes
1 answer

Serializing a Recursive Class with Jackson (JSON)

I've defined a tree of HashMaps like so: public class HashTree extends HashMap> { private static final long serialVersionUID = 1L; boolean isLeaf = true; private HashMap value = new HashMap(); …
0
votes
1 answer

CakePHP deeper recursive

I have the following problem. I have the following relationships: A->B->C->D With the respective relations in models. I need to get all the "D" belonging to "A" $this->A->B->C->D->find('all', array ('conditions' => array('B.a_id' =>…
Adr
  • 3
  • 1
0
votes
1 answer

Entity framework : Recursive update Parent-Child gives me duplicates

Given the following tables (in screenshot FK from Locations to Customers is not visible, but it's there, just didn't refresh...): And my mapping: protected override void OnModelCreating(DbModelBuilder modelBuilder) { …