Hi,
I need some advice on the data structures to use in C#. My need is to construct a something like a code syntax tree. what would the embedded data structures in C# to use so as to ensure memory optimisation and run time efficiency currently, stacks/lists/ dictionaries are my choice of options.
If any experienced C# developer would give me some sound advice, I would like to hear from you. Thanks

Data structures in C#
Jason Beard
PublicError
Mkennie
Are you trying to execute these statements Are you building something like an interpreter Than you definitly should go for recursion.
The articles posted by Indian Ocean are good but are only talking about your basic acadamic datastructures. I'm not sure this is what you want.
Leed3
Hi,
The following would give you good pointers,
http://msdn2.microsoft.com/en-us/library/ms379573(vs.80).aspx
http://dotnetjunkies.com/WebLog/debasish/archive/2006/05/27/139143.aspx
HTH,
LOTG
rofu
Basalingamma
it is a tree used to store code in terms of statements and expressions. it is pretty much alike to the binary search tree but not all nodes have 2 edges. what do you mean by implementing the stack implicitly using recursion the stack simply is to handle nested statements like 'while' or 'if'. and the pushing and popping will be taxing if I have 10000 nested whiles. if simply there are other data structures that could cater to nesting the nodes such that after I have constructed a sub tree, i need not pop up till I reached the root of the sub tree to carry on building another subtree from there, I would be all ears.
Eighty
my performance analysis more likely has to do with how fast a query (something like sql query) can analyse a static program (i.e C program). but more likely this efficiency can be achieved through other means. why am I concerned with stack let's say I have a billion lines of static program code which I need to build into a very large tree how fast could i build it using means that are efficient i need to take into account the computation time. and i also know stacking can also perform a bit of trick by matching braces and brackets to evaluate algebra expressions in the program. but for each line of code which is an algebra expression, i need to perform pushing and popping which is taxing. the program can also contain nested while and nested if which we should not forget. sort of like a syntax tree..hope you could picture it =)
i.e 1 line of code which is x = (1+2)*3+4+(7*8)+....so on
could you elaborate to me how fast could the pushing and popping means in terms of secs. neway Thanks
vijil
lfnovo
Billy2005
I saw the articles but they are just basic usage of data structures. I am coding a parser cum analyzer of programs. recursion is intuitive but it would cause a lot of memory overheads as it eats up into the heap. so I was thinking if there were any methodology that would optimise the building of a syntax tree, best if I could use some advanced data structures to ease the algorithm part. =)
hellosmithy
Nick_Dev
CSharpNewbie22
Push and Pop from the program stack are very fast operations because the memory for the system stack does not need to be allocated on forhand. it's already allocated and the CLR checks for overflow. Recursion is based on keeping information in paramaters passed in function calls. Function parameters are always passed on the stack. Maybe I can help you a little bit more if you tell me what kind of analysis you're trying to do. Maybe give a little sample of the code you're trying to parse as well.