Data Structure
Data Structure
❖ Data Structure:
Definition:
● Data is a collection of numbers, alphabets and special symbols which are used to represent an
information.
● The proper arrangement of data is known as data structure.
● The systematic representation of data in main memory is known as data structure.
● Data can be organized in different ways.
● The logical or mathematical model of a particular organization of data is called as data structure.
● A data structure is a way of storing data in a computer so that it can be used efficiently.
● We need to store the data in such a way that may grow & shrink dynamically.
● If we organize the information in some proper manner then we can access it using efficient
algorithm.
● Data structures are uses many efficient algorithms, & because of that it is possible to manage the
huge amounts of data.
● Abstract Data type (ADT) is a type for objects whose behavior is defined by a set of value and a
set of operations.
● The definition of ADT mentions what operations are to be performed on the objects without
giving the detail information about the how these operations will be implemented.
● It does not specify how data will be organized in memory and what algorithms will be used for
implementing the operations.
● It is called as “Abstract” because it will show only essential details and hide the unwanted details.
Data Structure by Mr. Vishal Jadhav Sir’s (VJTech Academy, contact us: +91-9730087674) 1
Chapter 01 Introduction to Data Structure VJTech Academy
● The process of providing only the essentials details and hiding the unwanted details is known as
abstraction.
● For example, we use int, float, char data types for storing values and performing the various
operations. But we don’t know how these operations are performed on the data.
● It means user only understand what are the data types and what it does but they don’t know how it
will manage data in memory and how it will do the various operations.
● ADT as a black box which hides the inner structure and design of the data type.
1. Integer
2. Float
3. Character
4. Pointer
Data Structure by Mr. Vishal Jadhav Sir’s (VJTech Academy, contact us: +91-9730087674) 2
Chapter 01 Introduction to Data Structure VJTech Academy
● Data structures are basically a way of storing and logically implementing the data elements.
● Primitive data structures which include the int, char, float, double and the non-primitive data
structures can broadly be classified into two types:
Data Structure by Mr. Vishal Jadhav Sir’s (VJTech Academy, contact us: +91-9730087674) 3
Chapter 01 Introduction to Data Structure VJTech Academy
● In this type of data structure, all the data elements are stored in a particular sequence.
● In this type of data structure, all the data elements do not form any sequence.
The basic operations that are performed on data structures are as follows:
4. Sorting: It is an arranging data in some logical order, it may be in ascending or descending order.
6. Merging: It is used to combine the data items of two data structure into single data structure.
Data Structure by Mr. Vishal Jadhav Sir’s (VJTech Academy, contact us: +91-9730087674) 4
Chapter 01 Introduction to Data Structure VJTech Academy
❖ Algorithms Complexity:
Time complexity:-
● Time complexity of a program/algorithm is the amount of computer time that it needs to run to
completion.
● How much time required for execution of given program/algorithm is know as time complexity.
● While calculating time complexity, we develop frequency count for all key statements which are
important and basic instructions of an algorithm.
● How much time program controller visits a particular line, that count is known as frequency
count.
● Example:
1. sum=0; 1
2. for(i=1;i<n;i++) n+1
3. sum=sum+i; n
4. printf(“%d”,sum); 1
So the time complexity is 2n+3 and if we represent this time complexity using Big-Oh notation
then it will be O(n).
Space complexity:-
Data Structure by Mr. Vishal Jadhav Sir’s (VJTech Academy, contact us: +91-9730087674) 5
Chapter 01 Introduction to Data Structure VJTech Academy
● Example:
1. sum=0;
2. for(i=0;i<n;i++);
3. {
4. sum=sum+i;
5. }
6. printf(“%d”,sum);
Above example consists of three variables i,n,sum of integer type so fixed part space complexity
is 6 byes and variable part is 0 bytes. So total space complexity is 6 + 0 = 6 bytes
Important Questions:
Data Structure by Mr. Vishal Jadhav Sir’s (VJTech Academy, contact us: +91-9730087674) 6