Help shape GoConqr. What should we add next?

Flashcards

F453 Data Structures - Stacks and Queues

harvs899 English 4.0Average rating 4.0 out of 5 (1 rating) 22 cards

Cards in this deck (22)

  1. 1What is a static data structure?A data structure which can not change size at runtime.
  2. 2What is a dynamic data structure?A data structure which can change size at runtime in order to accommodate stored data.
  3. 3What is a LIFO data structure?The last item pushed in is the first to be popped out (Last In First Out). Imagine a stack of plates.
  4. 4What is a FIFO data structure?The first item to be pushed in is the first item to be popped out (First In First Out). Imagine a queue in a shop.
  5. 5How is the location of the top of a stack kept track of?The stack pointer, this points to the top most item in the stack - not the free space above the stack!
  6. 6In a queue how many pointers are there and what are they?There are two pointers, the front and back. Which obviously point to the front and back items of the queue.
  7. 7Are items actually deleted from the stack? If not what happens instead?The stack pointer is simply decremented, leaving the 'deleted' item to be overwritten the next time something is pushed on to the stack.
  8. 8If you add an item to a stack you _____ the item on to it.Push.
  9. 9If you remove an item from a stack you ____ an item off of it.Pop.
  10. 10What happens if the stack gets too large?Stack overflow exception.
  11. 11What is a stack underflow?This occurs when you try to remove an item from an empty stack.
  12. 12In a queue what does it mean when the front and back pointers are in the same location?The queue is empty.
  13. 13What is the algorithm for pushing on to a stack?Check to see if the stack is full, if it is report an error and stop. If it is not full, increment the stack pointer, add the item to the top of the stack then stop.
  14. 14What is the algorithm for popping off of a stack?Check to see if the stack is empty, if it is report an error and stop. If it is not empty, copy the item off the stack then decrement the stack pointer.
  15. 15Where is an item removed from a queue?The front.
  16. 16Where is an item added to a queue?The back.
  17. 17What are the advantages of a static data structure?They are easier to program, easy to check for overflow, compiler allocate space at compile time and an array allows random access.
  18. 18What are the disadvantages of a static data structure?The programmer must estimate the maximum amount of space required, it can also be wasteful of memory.
  19. 19What are the advantages of a dynamic data structure?Only uses the space required, makes efficient use of memory and storage no longer required can be returned to the system for other uses.
  20. 20What are the disadvantages of a dynamic structure?Difficult to program, can be slow to implement searches and a linked list only allows serial access.
  21. 21What is the algorithm to enqueue an item?Check to see if the queue is full, if it is report an error and stop. If it is not full then allocate memory to a new node and adjust the rear pointer to accommodate the new item.
  22. 22What is the algorithm to dequeue an item?Check to see if the queue is empty, if it is report and error and stop. If it is not empty mark the memory that the item used as free and adjust the front pointer to locate the previous item.

Information

Description
Flashcards on F453 Data Structures - Stacks and Queues, created by harvs899 on 02/05/2014.
Created by
harvs899
Views
521
Tags
a levelcomputingdata structurescomputer sciencestacksqueuesdata
Rating
Average rating 4.0 out of 5 (1 rating)

More on Stacks and Queues

Feedback

What is it about?

What should we add next?