Question

Is it possible to ignore one from a stack or queue algorithm? Which one you think...

Is it possible to ignore one from a stack or queue algorithm? Which one you think is useless and why?

Homework Answers

Answer #1

No its not possible both of them have their own importance as the stack is used in implementing recursion because of its Last in First out property.

Queues are used for scheduling the programs.

But if still, we have to choose one of them then it would be stack as scheduling is important and not able to implement recursive programs can be taken care of as we can convert any recursive program to an iterative solution but the implementation can be difficult but its possible.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
IN JAVA One possible application of a Stack is to check for balanced parentheses or braces...
IN JAVA One possible application of a Stack is to check for balanced parentheses or braces in an expression. An expression is considered to be balanced if:  There are an equal number of open and close parantheses; AND  Every closed parenthesis seen (when parsing the expression from left to right) must be paired with a previously seen open parenthesis. Write an algorithm (not code, an algorithm) for how you would use a stack to check for balanced parentheses....
IN C++ - [(1)] Design a Stack that is composed ONLY of one or two Queue...
IN C++ - [(1)] Design a Stack that is composed ONLY of one or two Queue objects ergo the ONLY instance variables that exist in this stack are queues. Stack class should contain the following methods: Print, Pop, Push, Top, Size, isEmpty, copy [(2)] Design a Queue that is composed ONLY of two Stacks objects ergo the ONLY instance variables that exist in this queue are stacks. Queue class should contain the following methods: Print, Enqueue, Dequeue, Front, Rear, Size,...
Suppose you have a stack S containing n elements and a queue Q that is initially...
Suppose you have a stack S containing n elements and a queue Q that is initially empty. Write a program in which you can use Q to scan S to see if it contains a certain element x, with the additional constraint that your algorithm must return the elements back to S in their original order. You may only use S, Q, and a constant number of other primitive variables
Stack Queue Program Implement a Stack class using the List Class you developed earlier. Test your...
Stack Queue Program Implement a Stack class using the List Class you developed earlier. Test your Stack class by determining if the following strings have matching open and closing ( ) and/or [ ] and/or { }. To test matches, push open (, [, { onto the stack. Input a close char, pop off the stack and see if input matches symbol form stack.   Use the following data to test your code:                               ( )                               [ ] ( )...
Generate 100 random numbers and add them to a stack and a queue, after print out...
Generate 100 random numbers and add them to a stack and a queue, after print out the content from both stack and queue, sort the data from both in ascending order, then print out again, after being sorted, and go through both the stack a queue and remove an element one at a time till empty then print out a message saying its empty. print out how much time it took to do this process, basically compare the stack and...
Assume you have a stack and a queue implemented using an array of size 4. show...
Assume you have a stack and a queue implemented using an array of size 4. show the content of the array for the stack (then the queue) for the following operations: (for the queue replace push by add and pop by remove; keep in mind that the queue uses a circular array): push(-3), push(-5), push(-9), push(-10), pop(), pop(), push(-13), pop(), push( -15), push(-17).
TestQueue.java Design a class named Queue for storing integers. Like a stack, a queue holds elements....
TestQueue.java Design a class named Queue for storing integers. Like a stack, a queue holds elements. But in a queue, the elements are retrieved in a first-in first-out fashion. The class contains: An int[] data field named elements that stores the int values in the queue. A data field named size that stores the number of elements in the queue. A constructor that creates a Queue object with default capacity 8. The method enqueue(int v) that adds v into the...
Give the algorithm for the structure Queue that keeps the front and rear “pointers” from progressing...
Give the algorithm for the structure Queue that keeps the front and rear “pointers” from progressing through all of memory (assume the Queue array has n elements)
Restricted structures such as stack and queue are fast, but they do not support access in...
Restricted structures such as stack and queue are fast, but they do not support access in the key field mode. Group of answer choices True False Big O analysis evaluates an algorithm based on its _________ performance. Group of answer choices A. average-case B. best-case C. worst-case Which of the following algorithms is the fastest in speed? Group of answer choices A. Polynomial time algorithm B. Linear time algorithm C. Exponential time algorithm The following code gives an implementation of...
Which end of the python list should be the top of a stack and why? Which...
Which end of the python list should be the top of a stack and why? Which end of a linked list should be the front of a queue and why?