Question

In: Computer Science

Internal implementations of stacks and queues require the tracking of more information than simply the data...

Internal implementations of stacks and queues require the tracking of more information than simply the data being stored in the stack or queue. What is the nature of this information and why does it need to be stored? Does it differ between the objects? If so, how and why does it differ? If not, why can it be the same across object types?

Solutions

Expert Solution

  • Stack is internally implemented in such a way that the element inserted at the last in stack would be the first element to come out of it.So stack allows LIFO(Last in and First Out).
  • Queue is implemented in such a manner that the element inserted at the first in queue would be the first element to come out of it.So queue follows FIFO(First in and First Out).
  • Adding and removing operations in stack is known as push and pop respectively.
  • Adding and removing operations in queue is known as enqueue and dequeue.
  • In stack only one flag is maintained to access the list which always point to the last element present in the list.
  • In Queue two flags are maintained to access the list.The front flag always points to the first element inserted in the list and is still present,and the rear flag always points to the last inserted element.
  • Stack does not have any varient and not implemented further.
  • Queue has varients like circular queue,priority queue,doubly ended queue.
  • Stack is more simpler than Queue.
  • Both data structure are useful to store the data objects.So it will take almost the same size memory to store the same amount of data elements.
  • Stack needs only one pointer called top-pointer.(It points to the topmost object in the stack)
  • The queue requires two pointers.(One is front and the other is rear pointer).

Related Solutions

Array-based implementations of stacks and queues require the knowing the location of data within the arrays....
Array-based implementations of stacks and queues require the knowing the location of data within the arrays. However, these two data structures store data differently. What is this difference and why does it exist? Could the stack-approach be used to store information within queues (or the other way around)? Why or why not? If it is possible, what would be the side effects of such an approach?
JAVA *** All data structures, including array operations, queues, stacks, linked lists, trees, etc need to...
JAVA *** All data structures, including array operations, queues, stacks, linked lists, trees, etc need to be implemented by you. Write a menu driven program that implements the following Binary Search Tree Operations FIND (item) INSERT (item) DELETE (item) DELETE_TREE (delete all nodes - be careful with the traversal!)
Provide an example of when external Benchmarking provides more meaningful data than internal Benchmarking data? Provide...
Provide an example of when external Benchmarking provides more meaningful data than internal Benchmarking data? Provide an example of when internal Benchmarking provides more meaningful data than external data?
If you haven't heard of the term "continuous auditing" it is a little more than simply...
If you haven't heard of the term "continuous auditing" it is a little more than simply the continuous monitoring of the or a business process/transaction cycle. Continuous auditing will demand the involvement of Accounting Information Service and IT professionals. Let's explore (research) this topic and discuss what it means for us. We'll need some definitions, best practices, critical players, helpful technology (hardware/software, and, of course, specifics) for our role.
Explain why there is more to system integration than simply recompiling the code of the software.
Explain why there is more to system integration than simply recompiling the code of the software.
Engineering an entire photosynthetic pathway is more complicated than simply inserting a gene for, say, an...
Engineering an entire photosynthetic pathway is more complicated than simply inserting a gene for, say, an insecticidal protein into the genome of a crop. How does the fact that C4 photosynthesis has evolved naturally many times in the grass family (which includes rice) suggest that it may be possible to introduce this trait to rice
Private Equity investors often require internal rates of return of more that 25% on the investments...
Private Equity investors often require internal rates of return of more that 25% on the investments they make. 1.How are these required rates of return justified? 2.Explain how the practice of demanding a high risk premium is inconsistent with using expected cash flow forecasts that include a realistic view of the possible downside of the investment to value a business.
Directional drilling is much more than simply selecting a well path and hole angle. It includes...
Directional drilling is much more than simply selecting a well path and hole angle. It includes selecting the most appropriate survey techniques, defining the best control tools, researching applicable government regulations, and gathering pertinent geological data. By considering the following aspects explain how these factors affecting your directional drilling choice to apply a proper technique to achieve your target. i. Reasons for use directional drilling technique. ii. Problems associated with directional drilling. iii. All variables required for directional well planning....
Replace the lines marked with // *** with the appropriate C# code (may require more than...
Replace the lines marked with // *** with the appropriate C# code (may require more than one line of code to complete the missing parts). // Program Description: This program uses two user defined methods to compute // the gross pay and net pay for an employee after entering the employee’s // last name, hours worked, hourly rate, and percentage of tax. using System; public static class Lab6 { public static void Main() { // declare variables int hrsWrked; double...
Explain why the financial statements are much more than simply accounting and numbers. Your assessment should...
Explain why the financial statements are much more than simply accounting and numbers. Your assessment should include a discussion of each of the financial statements, what each statement represents, and its importance. In addition, you will discuss the different financial ratio categories, what they tell us, along with why the statements and ratios are important to managers, creditors, and investor
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT