I am currently studying for my DataStructures final examination and there is one thing that i just can never grasb. I cant seem to be able to recursivly define abstract data structures such as linked bags, lists, sets, stacks, queues, deques, ect... I can never seem to figure out how to create the recursive definitions.
We always have a cons method (which will construct a new structure of the type, from like a head and tail), and equals, and getHead (or get first), getNext ect...
So this question may seem very vauge, but ive done a lot of reading for my exam, and i just can never seem to get the recursive definitions correct. Is there some kind of trick to it. I am doing this in Java if it helps :-)
Thanks for any tips, i know that this post may seem very unclear :-)