I'm trying to write a C code to simulate a Non Deterministic Turing Machine. So far i've already implemented the input tape and the transition tape, using a simple double linked list for the first, and a linked list for the second.
The idea was to build a Computational Tree like this: Computational Tree
Where each node consists in a configuration of my Turing Machine:
- Current State
- Content of the Input Tape
- Position of the Pointer in the Input tape
Because of non determinism i have to check and run recursively through the whole tree, which implies avery large amount of memory allocation ( 1 node for each possible configuration ).
Is there a better data structure to simulate a ND Turing Machine? I was thinking about Orientated Graphs (which is also what you usually use to describe a Turing Machine on paper) and implement it using an Adjacency List like suggested here: Adjacency list (because i don't know a priori the number of possible states, and arrays in C are not dynamic).