DataStructure and AlgorithmEDITED
DataStructure and AlgorithmEDITED
STRUCTURE
Vaibhav P Mujmule
DATA STRUCTURE
B.SC. II (SEM – III)
Vaibhav P Mujmule
Syllabus
Unit 1
Data Structure: introduction to data structure, types of data
structure: primitive and non primitive, linear and non linear DS,
Data structure operations.
Linear Arrays: Definition and concepts, representation,
operations on arrays: traversing, inserting, operations.
Stacks: Definition and concepts, representations, operations on
stack: Push and Pop.
Introduction to Data Structure
Computer is an electronic machine which is used for data processing and
manipulation.
When programmer collects such type of data for processing, he would
require to store all of them in computers main memory.
In order to make how computer work we need to know
Representation of data in computer.
Accessing of data.
How to solve problem step by step.
For doing all of this task we used Data Structure
What is Data
Structure
A data structure is a
specialized format for
organizing, processing,
retrieving and storing
data.
In computer
programming, a data
structure may be
selected or designed to
store data for the
purpose of working on it
with various algorithms.
What is Data
Structure
Data Structure can be defined as the group of data elements which provides an
efficient way of storing and organizing data in the computer so that it can be
used efficiently.
examples of Data Structures are arrays, Linked List, Stack, Queue, etc.
Data Structures are widely used in almost every aspect of Computer Science i.e.
Operating System, Compiler Design, Artificial intelligence, Graphics and many
more.
Data Structures are the main part of many computer science algorithms as they
enable the programmers to handle the data in an efficient way.
It plays a vital role in enhancing the performance of a software or a program as
the main function of the software is to store and retrieve the user’s data as fast
as possible
Data Structure
◦ A data structure is a particular way of organizing data in a computer so that it can be used
effectively.
◦ For example, we can store a list of items having the same data-type using the array data
structure.
The representation of particular data structure in the main memory of a computer is called as
storage structure.
The storage structure representation in auxiliary memory is called as file structure.
It is define as the way of storing and manipulating data in organized form so that it can be
used efficiently
Data Structure mainly specifies the following four things:
1)organization of data 2)accessing method 3)degree of associativity 4) processing
alternative for information
Algorithm + Data Structure = Program
Data Structure study Covers the following points
1) Amount of memory require to store
2) Amount of time require to process
3) Representation of data in memory
4) Operations performs on data
Types Of
DS
◦ Every item is related to its previous ◦ Every item is attached with many
and next item. other items.
◦ Data is arranged in linear sequence. ◦ Data is not arranged in sequence.
◦ Data items can be traversed in a ◦ Data cannot be traversed in a single
single run run.
◦ E.g. Array, Stacks, Linked list, Queue ◦ E.g. Tree, Graph
◦ Implementation is easy. ◦ Implementation is difficult.
Operation on Data Structures
Design of efficient data structure must take operations to be performed on the DS into account.
The most commonly used operations on DS are broadly categorized into following types
1. Create: This operation results in reserving memory for program elements. This can be done by
declaration statement Creation of DS may take place either during compile-time or run-time.
2. Destroy: This operation destroy memory space allocated for specified data structure .
3. Selection: This operation deals with accessing a particular data within a data structure.
4. Updation: It updates or modifies the data in the data structure.
5. Searching: It finds the presence of desired data item in the list of data items, it may also find
locations of all elements that satisfy certain conditions.
6. Sorting: This is a process of arranging all data items in a DS in particular order, for example
either ascending order or in descending order.
7. Splitting: It is a process of partitioning single list to multiple list.
8. Merging: It is a process of combining data items of two different sorted list into single sorted
list.
9. Traversing: It is a process of visiting each and every node of a list in systematic manner.
What are Arrays?
Syntax
arrayName[indexNum]
Example
balance[1]
Here, we have accessed the second value of the array using its index, which is 1.
The output of this will be 200, which is basically the second value of the balance
array.
◦ Array Representation
◦ Arrays can be declared in various ways in different languages. For illustration, let's take C array declaration.
Internal Sorting
Sorting. ◦ Any sort algorithm which uses main
memory exclusively during the sort.
◦ One fundamental problems of computer ◦ This assumes high-speed random
science is ordering a list of items. access to all memory.
◦ Many solutions exist to this problem, known as
External Sorting
sorting algorithms.
◦ Any sort algorithm which uses main
◦ Some sorting algorithms are simple and
memory exclusively during the sort.
intuitive, such as the bubble sort.
◦ Any sort algorithm which uses external
◦ Others, such as the quick sort are extremely
memory, such as tape or disk, during the
complicated, but produce lightning-fast results sort.
Sorting algorithms are divided into two ◦ Used when the data no not fit into the
categories: main memory
◦ Internal Sorts and ◦ Note:
◦ External sorts. ◦ Algorithms may read the initial values from
magnetic tape or write sorted values to
disk, but this is not using external memory
Thank You