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

Data Structure

The document introduces key concepts related to data structures including: - Data structures provide a systematic way to organize and store data in memory for efficient use. - They can be classified as linear (arrays, stacks, queues) or non-linear (trees, graphs) based on how elements are arranged. - Common operations on data structures include insertion, deletion, searching, sorting, and traversing. - Time and space complexity analysis measures how long and how much memory algorithms require. - Abstract data types (ADTs) define operations on a data type without specifying implementation details.

Uploaded by

singare sanyam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
421 views

Data Structure

The document introduces key concepts related to data structures including: - Data structures provide a systematic way to organize and store data in memory for efficient use. - They can be classified as linear (arrays, stacks, queues) or non-linear (trees, graphs) based on how elements are arranged. - Common operations on data structures include insertion, deletion, searching, sorting, and traversing. - Time and space complexity analysis measures how long and how much memory algorithms require. - Abstract data types (ADTs) define operations on a data type without specifying implementation details.

Uploaded by

singare sanyam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 01 Introduction to Data Structure VJTech Academy

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

Need of Data Structure:


● Data structures are an important way of organizing information or data in a computer.

● It has a different ways of storing & organizing data in a computer.

● It helps to understand relationship of one data element with other.

● It helps to store data in logical manner.

● 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):

● ADT stands for Abstract Data Types.

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

❖ Classification of data structure:


The classification of data structure mainly consists of :

1. Primitive data structure

2. Non-primitive data structure

Primitive data structure :


● The primitive data structures are known as basic data structures.
● All basic data types of any language are called as primitive data types.
● It defines how the data will be internally represented in, stored and retrieve from memory.
● Example.

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

Non-Primitive data structure :


● All the data structures derived from primitive data structures are called as non-primitive data
structures.
● The non-primitive data structures are highly developed complex data structures.
● The non-primitive data structure is responsible for organizing the group of homogeneous and
heterogeneous data elements.
● Example.
1. Arrays
2. Lists
I) Linear data structure
a) Stack
b) Queue
II) Non-Linear data structure
a) Tree
b) Graph
3. Files

❖ Linear and Non Linear Data Structure:

● 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:

1. Linear Data Structure

2. Non-Linear Data Structure

Data Structure by Mr. Vishal Jadhav Sir’s (VJTech Academy, contact us: +91-9730087674)​ 3
Chapter 01 Introduction to Data Structure VJTech Academy

Linear Data Structure:

● In this type of data structure, all the data elements are stored in a particular sequence.

● All elements are arranged in linear fashion.

● The sequential organization of data elements is known as linear data structure.

● Examples: Array, Linked List, Stack, Queue, etc.

Non-Linear Data Structure:

● In this type of data structure, all the data elements do not form any sequence.

● All elements are arranged in non-linear fashion.

● The randomly organization of data elements is known as non-linear data structure.

● Examples: Tree, Graph, Table, etc.

❖ Operations on Data Structure:

The basic operations that are performed on data structures are as follows:

1. Insertion:​​ It is adding a new data in data structure.

2. Deletion: ​It is removing a data from existing data structure

3. Searching:​​ It is finding location of data within given data structure

4. Sorting: ​It is an arranging data in some logical order, it may be in ascending or descending order.

5. Traversing:​​ It is an operation that access each and every element.

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:

Sr.No Statement Frequency count

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:-

● Space complexity of a program/algorithm is the amount of memory that it needs to run to


completion.
● How much space is required for execution of given program/algorithm is known as space
complexity.
● The space complexity consists of two parts:
1. Fixed space part: It includes space for instructions, for simple variables, fixed size
structured variables and constants.
2. Variable space part: It consists of space needed by structured variables whose size
depends on particular value of variables.

Space Complexity = Fixed part space + Variable part space

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

❖ Define Big ‘O’ Notation:


● This notation is used to represent time complexity of algorithm/program.
● Big O is a mathematical notation that represents time complexity of an algorithm.
● O stands for order of term and it is pronounced as ​Big-Oh.
● This notation calculate the upper bound value of given function.
● Suppose, if we have two functions i.e f(x) and g(x) then f(x) is said to be O(g(x)) if there exists
two positive constants c and k such that ​f(x) <= c(g(x) ​for all x>=k

Important Questions:

1. Define Abstract Data Type. ​2 Marks


2. Explain time complexity and space complexity. (2M for time complexity and 2M for space
complexity) ​4 Marks
3. Define data structure and give its classification (Definition - 1 Mark, Classification -1 Mark)
​2 Marks
4. Enlist various types of operation on data structure (Any 4 operations) ​2 Marks
5. Define primitive and non-primitive data structure. ​4 Marks
6. State the need of data structure. Write any four operations perform on data structure. ​4 Marks

Data Structure by Mr. Vishal Jadhav Sir’s (VJTech Academy, contact us: +91-9730087674)​ 6

You might also like