Due: Tuesday Feb 27, 2008
Stacks are First In Last Out (FILO) data structures. What that means is that it works like a stack of dishes (duh!). Whatever you put on the top will have to come off first before you can access what's at the bottom. What's at the top is the most recent one put on.
Please implement the following within the Node class from lecture (refer to lecture 7):
- Node pop_back() - It returns the last element of a list and removes it from the list before it returns it.
Queues are the reverse of stacks in that they are First In First Out (FIFO). It works like a line in the bank or food cart. The first person that gets there is the first served. This is most fair.
Please implement the following within the Node class from lecture:
- void push_front(Node D) - puts the node D in the front of the list
- Node pop_front() - returns the head of the list after removes it from the list
Within the TreeNode class from lecture (lecture 7) and implement the following:
- void display() - displays the tree in such a way that every level of the tree is properly indented by height... so that height of 2 will give you 2 indentations and 1 will give you 1 indentation. The children is supposed to come after the parents immediately... like in file explorer how you expand all the folders.