Update later...
- Example of Queue
- By Nguyen Anh Tuan, view more
*Note: Queue always has a clear (a method is used to clear all nodes), default constructor, arguments constructor and destructor (if the language supports). Create some classes:
- Drink and Food have name, price. Drink has private property is type = “drink” and type = “food” for Food.
Questions:
- Create a generic Queue has dequeue, enqueue, getSize, isEmpty. Initializer 2 queue of Drinks and Foods (each queue has arbitrary numbers of items). Perform all methods of Stack.
- Create a generic Queue to control the sequence of processes (callbacks, instances of class are recommended). Add perform method to perform the first Node’s task, then dequeue.