question archive Stacks and queues are similar except in how they process the entries

Stacks and queues are similar except in how they process the entries

Subject:Computer SciencePrice: Bought3

Stacks and queues are similar except in how they process the entries. Stacks use FIFO, queues use LIFO.

1)Discuss which should be used in "real world" situations.

2)Reply to others with support for or arguments against their examples.

Part 2 Resond to Peer Reviews

Respond to two peer reviews

Peer 1 David

Stacks, which uses FILO (first-in-last-out), are great with recursion. Now in this case we do not see the stack or write the stack but if you remember recursion from the first week recursion runs all the way to the base case and works back to the original function call. Another thing stacks are good for is keeping track of every webpage you have been to so when you click the back or forward button it goes to the right page.

Queues, which uses FIFO (first-in-first-out), are great in any case where you want to maintain the order the instructions come in. For example, if 50 employees are trying to access a work database for information it would supply them the information in the order they requested the information. Queues also are good for computers themselves. Say you have a duel-core processor. This means it can only handle two instructions at a time. If it gets more than two instructions, it can use a queue to handle the instructions in the order given.

Peer 2 Toni

A helpful analogy is to think of a stack of books; you can remove only the top book, also you can add a new book on the top. a stack is either empty or it consists of a top and the rest which is a stack.

 In the queue only two operations are allowed enqueue and dequeue. Enqueue means to insert an item into the back of the queue, dequeue means removing the front item. The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE