Summary of Linked Lists, Stacks, Queues Data Structures PowerPoint PPT Presentation

presentation player overlay
1 / 10
About This Presentation
Transcript and Presenter's Notes

Title: Summary of Linked Lists, Stacks, Queues Data Structures


1
Summary of Linked Lists, Stacks, Queues Data
Structures
2
Linked Lists
  • The most flexible data structure
  • Can add, delete elements anywhere in the
    structure
  • Can be ordered or unordered
  • Doubly linked lists for faster searching (can go
    backward in the list as well as forward)

3
Stacks
  • Last-in, first-out data structure (push, pop)
  • Access is at one point (top of the stack)

4
Queues
  • First-in, first out data structure
  • Enqueue elements at rear, dequeue at front

5
Stack and Queue Enhancements
  • Provide count of elements
  • Peek at top of stack or queue (get the data but
    leave element in place)
  • Add, delete element anywhere in the structure

6
Data Structure Representation
  • Linked lists, stacks, queues, can be represented
    by
  • Static array
  • Dynamic array
  • Dynamic nodes

7
Static Array Representation
  • When the maximum size is known at compile time
  • Adding, deleting to an ordered static array
    linked list may require significant data movement

8
Dynamic Array Representation
  • When the maximum size is not known until program
    execution
  • Adding, deleting to an ordered dynamic array
    linked list may require significant data movement

9
Dynamic Node Representation
  • No size limitation
  • Adding and deleting nodes require operating
    system calls (new delete) that take time

10
Choosing a Representation
  • Considerations
  • Size
  • If maximum size cannot be predicted, use dynamic
    nodes
  • Performance
  • As discussed above, representations can affect
    performance
  • Implementation Complexity
  • For your situation, one implementation may be
    much simpler than others
Write a Comment
User Comments (0)
About PowerShow.com