I have been sitting on this for about 2 days now. My assignment is to create a leftist max d-heap in java. I am provided with the outline as follows:
public LeftistDHeap(int d)
public void enqueue(T element)
public T dequeue()
public String breadthFirstSearch()
public String depthFirstPreOrder()
public String depthFirstPostOrder()
public void combine(LeftistDHeap<T> other)
public boolean isEmpty()
So I have done all the functions they ask for here (only not depthFirstPostOrder()). My Node class is like a normal treeNode class, only instead of left and right, I have an array of pointers to the children.
I just cant figure out the logic on how to do a post-order traversal in this tree. I binary post search is easy, so is there a way to convert the normal binary tree post-order algorithm to work with a tree with d-amount of children?