Data Structures and Algorithms
Data Structures and Algorithms
AND ALGORITHMS
Introduction to data structures
The data structure is not any programming language like C, C++, java,
etc. It is a set of algorithms that we can use in any programming
language to structure the data in the memory.
Classification of Data Structures
Data Structure
Non
Primitive Primitive
Lists
Float Pointer
Files
Primitive Data Structures
These data types are also called Simple data types, as they contain
characters that can't be divided further
Non –primitive Data Structures
These are used to represent simple values These are used to represent more complex
such as integers, booleans, and characters data objects such as arrays, queues, trees,
and stacks
It has a fixed size and range of values They can be resized or modified during
runtime
These are defined by the language These are defined by the programmer
Arrays
An Array is a data structure used to collect multiple data elements of
the same data type into one variable.
1. Fixed size
2. Memory efficiency
3. Easy to implement
In a doubly linked list, each node contains references to both the next and previous nodes. This allows for
traversal in both forward and backward directions, but it requires additional memory for the backward
reference.
Null
Head Prev Data Next Prev Data Next Prev Data Next Null
CIRCULAR LINKED LIST
In a circular linked list, the last node points back to the head node, creating a circular structure.
It can be either singly or doubly linked.
In a singly linked list, each node contains a reference to the next node in the
sequence. Traversing a singly linked list is done in a forward direction.
Deletion: Removing a node from a linked list requires adjusting the pointers
of the neighboring nodes to bridge the gap left by the deleted node.