You are viewing a single comment's thread. Return to all comments →
LinkedList stack = new LinkedList(); LinkedList queue = new LinkedList(); void pushCharacter(char ch){ stack.addFirst(ch); } char popCharacter(){ return (char) stack.remove(0); } void enqueueCharacter(char ch){ queue.addLast(ch); } char dequeueCharacter(){return (char) queue.remove(0); }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 18: Queues and Stacks
You are viewing a single comment's thread. Return to all comments →