Questions on using or implementing more or less common data structures such as linked lists, structs, trees, tries, heaps etc. in Mathematica.

learn more… | top users | synonyms

53
votes
2answers
10k views

How can I use Mathematica's graph functions to cheat at Boggle?

Boggle is a word game played with 16 dice and a 4x4 tray. This question is inspired by a Stack Overflow question about Boggle that I decided to solve using Mathematica. In addition to Mathematica, I ...
14
votes
3answers
518 views

Using Memoization with a Mutable Object

In looking for a solution to this question, I ran across some old binary tree code by Daniel Lichtblau, reproduced below: ...
28
votes
4answers
2k views

How to create strong types?

In a program I'm writing, I create a list of lists, that looks something like this: {{100, {1,2,3,4,5}}, {105, {2,4,6,8}}, {42, {42,39,56}}} I then pass this ...
13
votes
4answers
415 views

Short syntax for accessing System`Utilities`HashTableAdd and System`Utilities`HashTableGet

I have a need for a struct analogue in Mathematica. After reading this post I came to the conclusion that System`Utilities`HashTable is one of the best options. But ...
8
votes
2answers
309 views

Cases[data,Colon[key,_]] vs. Cases[data,key:_] toward XPath, XQuery

Exploring methods to index and search tree-structured key:value pairs via named-entity index (key paths) as opposed to Position-based indexing. Using Rule as <...
74
votes
3answers
3k views

What is a Mathematica packed array?

A simple sounding question with a few sub questions: What is the difference between unpacked vs packed array? Are packed arrays more space efficent, how much so? Are packed arrays more time ...
4
votes
1answer
218 views

What's the most intelligent way to store the information of a selfmade graph?

I have a very long list of element, say $a1,a2, a3$,..., and they are all connected in that each is the child of many parents. E.g. $a74$ is associated with $a2,a55,a71$, and also contains information,...
21
votes
2answers
1k views

How can one define a custom data object?

In Mathematica there are different objects like InterpolatingFunction or SparseArray? How can I define a custom data object with ...
2
votes
1answer
251 views

Conditional Data Selection, efficiency

Building up on the solution proposed here : Simplifying nested If statements You can find here the data set : allGazes.dat ...
92
votes
7answers
10k views

Struct equivalent in Mathematica?

I really miss having something like a struct in Mathematica. I know of (and regularly use) a couple of programming techniques which feel like a ...
30
votes
2answers
1k views

Can a Trie be implemented efficiently?

What is the most space and time efficient way to implement a Trie in Mathematica? Will it be practically faster than what is natively available in appropriate cases?
97
votes
1answer
5k views

File-backed lists/variables for handling large data

Background Currently I am working with some large data (most of it generated by Mathematica itself). I usually find it a hassle to do this. For example, I just exported a large amount of data to ...