What is an Abstract Data Type (ADT)?
An ADT is a model for data characterized by a known set of behaviors (operations or methods). It defines what operations are to be performed
Why is an Abstract Data Type called ‘abstract’?
Because it provides an implementation-independent view of data
What does an ADT specify and not specify?
It specifies what operations can be performed
Give an example showing that an ADT can have multiple implementations.
The List ADT can be implemented using arrays
What is the process of providing only essentials and hiding details called?
Abstraction.
List the main characteristics of an Abstract Data Type (ADT).
What does ‘implementation-independent’ mean in the context of ADTs?
It means that the ADT describes operations and behavior without depending on any specific way of implementing or storing the data.
How does abstraction help in programming with ADTs?
It simplifies development by focusing on what operations an ADT performs rather than how it performs them
Stack
A linear data structure where elements are arranged in order and all operations occur at one end called the top; follows the LIFO (Last In
Stack Operations
Push (insert)
Stack Underflow
Occurs when attempting to pop an element from an empty stack.
Stack Overflow
Occurs when attempting to push an element onto a full stack.
Real-life Example of Stack
A pile of plates — the last plate added is the first to be removed (LIFO).
Time Complexity of Stack Operations
All primary stack operations (push
Applications of Stack
Undo/Redo operations
Queue
A linear data structure where insertion happens at the rear and deletion happens at the front; follows the FIFO (First In
Queue Operations
Enqueue (insert)
Difference Between Stack and Queue
Stack is LIFO (last in
Time Complexity of Queue Operations
All basic queue operations (enqueue
Real-life Examples of Queue
People standing in a line
Linked List
A linear data structure consisting of nodes connected by pointers; each node contains data and a pointer to the next node.
Linked List Operations
Get (retrieve)
Difference Between Linked List and Array
Arrays use contiguous memory and allow random access; linked lists use pointers
Advantages of Linked List
Dynamic size and easy insertion/deletion of nodes.