0% found this document useful (0 votes)
2 views

Data Structures and Algorithms

Uploaded by

Shruti Wali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Data Structures and Algorithms

Uploaded by

Shruti Wali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

DATA STRUCTURES

AND ALGORITHMS
Introduction to data structures

 Data Structures are a specialized means of organizing and storing data


in computers in such a way that we can perform operations on the
stored data more efficiently.

 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

Integer Character Arrays

Lists

Float Pointer
Files
Primitive Data Structures

 Primitive Data Structures are the data structures consisting of the


numbers and the characters that come in-built into programs.

 These data structures can be manipulated or operated directly by


machine-level instructions.

 These data types are also called Simple data types, as they contain
characters that can't be divided further
Non –primitive Data Structures

 Non-Primitive Data Structures are those data structures derived


from Primitive Data Structures.

 These data structures can't be manipulated or operated directly by


machine-level instructions.

 The focus of these data structures is on forming a set of data


elements that is either homogeneous (same data type)
or heterogeneous (different data types).
COMPARE PRIMITIVE AND NON-PRIMITIVE DATA STRUCTURE

Primitive Data Structures Non-Primitive Data Structures


 It has basic data types in programming  These are complex data types composed of
languages one or more primitive data types

 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.

 An Array is a list of elements where each element has a unique place


in the list.
Advantages and Disadvantages Of Array

1. Efficient access to elements

1. Fixed size

2. Memory efficiency

2. Memory allocation issues

3. Easy to implement

3. Insertion and deletion issues


DOUBLY LINKED LIST

 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.

Data Next Data Next Data Next


SINGLY LINKED LIST

 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.

HEAD Data Next Data Next Data Next NULL



Operations on Linked Lists

 Insertion:Adding a new node to a linked list involves adjusting the pointers of


the existing nodes to maintain the proper sequence.

 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.

 Searching: Searching for a specific value in a linked list involves traversing


the list from the head node until the value is found or the end of the list is
reached.
Applications of linked list

 Implementation of stacks and queues.


 Dynamic memory allocation.
 Maintaining a directory of names.
 Performing arithmetic operations on long integers.
 Manipulation of polynomials by storing constants in the node of the linked list
 Representing sparse matrices.
 Redo and undo functionality.
 Use of the Back and forward button in a browser.
THANK YOU

You might also like