Tos 055126
Tos 055126
Tos 055126
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.
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.
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 and ◦ Every item is attached with many other
next item. items.
◦ Data is arranged in linear sequence. ◦ Data is not arranged in sequence.
◦ Data items can be traversed in a single run ◦ Data cannot be traversed in a single 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?
Array is a container which can
hold a fix number of items and
these items should be of the
same type.
Most of the data structures make
use of arrays to implement their
algorithms.
•Following are the important
terms to understand the concept
of Array.
Element − Each item stored
in an array is called an element.
Index − Each location of an
1. An array is a container of elements. element in an array has a
2. Elements have a specific value and data type, like "ABC", TRUE or FALSE, etc. numerical index, which is used to
3. Each element also has its own index, which is used to access the element. identify the element.
• Elements are stored at
contiguous memory
locations.
• An index is always less than
the total number of array
items.
• In terms of syntax, any
variable that is declared as an
array can store multiple
values.
• Almost all languages have the
same comprehension of
arrays but have different
ways of declaring and
initializing them.
• However, three parts will
•Array name: necessary for easy reference to the collection of elements always remain common in all
•Data Type: necessary for type checking and data integrity the initializations, i.e., array
•Elements: these are the data values present in an array name, elements, and the data
type of elements.
How to access a
specific array
value?
You can access any array item by
using its index
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.