Refactored traversal related DS

implemented explicitly a Stack and Queue class.