Skip to Main Content
| Brooklyn College Library & Academic IT |CISC Department

CISC 3130 Data Structures: Stack & Queue with LL

Professor Chuang Spring 2020 OER

Logical Data Structures using Abstract Data Type (ADT)

Stacks and Queues are considered logical data structures. In Java refer to these as Abstract Data Types (ADT) because we can separate the ideas from implementation. For both of these we think about the operations to insert, delete, and peek. We don't really care where it is.

 

When implementing these ADTs we focus on where exactly the data is inserted and removed.

Stack

Queue

Stack is Last In, Last Out (LIFO)

  • Insert from the front
  • Remove from the front
  • Access the "top" of the stack in O(1)

Queue is First In, First Out (FIFO)

  • Insert from the end or last position
  • Remove from the front
  • Access the first element in the queue in O(1)
Simple Linked List Double Ended Linked List

 

Simple Linked List

Insert to last, delete from first

Double Ended Linked List

Insert to last, delete from first