DS - Unit - 1 - ADT & Address Calculation
DS - Unit - 1 - ADT & Address Calculation
Note – Dear Students apart from the topics discussed in the class it is suggested to
you to prepare the following topic s also from Unit 1.
They do not specify how the data structure must be implemented or laid out in
memory, but simply provide a minimal expected interface and set of behaviors.
For example, a stack is an abstract data type that specifies a linear data structure
with LIFO (last in, first out) behavior. Stacks are commonly implemented using
arrays or linked lists, but a needlessly complicated implementation using a binary
search tree is still a valid implementation.
Lists are linear data structures in which data is stored in a non - continuous fashion.
List consists of data storage boxes called 'nodes'.
These nodes are linked to each other i.e. each node consists of the address of some
other block. In this way, all the nodes are connected to each other through these
links.
remove() – Remove the first occurrence of any element from a non-empty list.
Stack ADT
Stack is a linear data structure in which data can be only accessed from its top. It
only has two operations i.e. push (used to insert data to the stack top) and pop
(used to remove data from the stack top).
Functions related o Stack are given below
pop() – Remove and return the element at the top of the stack, if it is not empty.
peek() – Return the element at the top of the stack without removing it, if the stack
is not empty.
Queue ADT
Queue is a linear data structure in which data can be accessed from both of its ends
i.e. front and rear. It only has two operations i.e. push (used to insert data to the
rear of the queue) and pop (used to remove data from the front of the queue).
dequeue() – Remove and return the first element of the queue, if the queue is not
empty.
peek() – Return the element of the queue without removing it, if the queue is not
empty.
Abstract data types (ADTs) are a way of encapsulating data and operations on that
data into a single unit. Some of the key features of ADTs include:
Abstraction: The user does not need to know the implementation of the data
structure only essentials are provided.
Robust: The program is robust and has the ability to catch errors.
Encapsulation: ADTs hide the internal details of the data and provide a public
interface for users to interact with the data. This allows for easier maintenance and
modification of the data structure.