SlideShare a Scribd company logo
Introduction to Algorithms
By
Nilesh Dalvi
Lecturer, Patkar-Varde College.Lecturer, Patkar-Varde College.
http://www.slideshare.net/nileshdalvi01
Java and DataJava and Data
StructuresStructures
Algorithm
The algorithm is defined as the a collection of
unambiguous instructions occurring in some specific
sequence and such an algorithm should produce
output for given set of input in finite amount of time.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Algorithm
• write an algorithm to count the sum of n numbers
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Algorithm sum (1, n)
{
//Problem Desc: Algorithm for finding sum of n numbers
//Input: 1 to n numbers
//Output: Sum of n numbers
result := 0;
for i:= 1 to n do i:= i + 1
result := result + i;
}
Algorithm
• write an algorithm to check whether the given no is
even or odd.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Algorithm EvenOddTest(val)
{
//Problem Desc: Algorithm for checking whether the given no is even or odd.
//Input: 1 to n number
//Output: Even or odd number
if(val % 2 == 0)
write("No is even");
esle
write ("No is odd");
}
Algorithm
• write an algorithm for sorting the given elements
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Algorithm Sort (a, n)
{
//Problem Desc: Algorithm for sorting the elements.
//Input: An array
//Output: Sorted array
for i:=1 to n do
{
for j:= i +1 to n-1 do
{
if(a[i]) > a[j]) then
{
temp := a[i];
a[i] := a[j];
a[j] := temp;
}
}
write("List is sorted!");
}
}
Algorithm
• write an algorithm for calculating factorial of n
numbers
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Algorithm factCalc (n)
{
//Problem Desc: For calculating factorial of given no
//Input: Number
//Output: Factorial of given number
if n := 1 then
return 1;
else
return n * factCalc(n - 1);
}
Algorithm
• write an algorithm for multiply two matrices
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Algorithm mulMatrix (A, B, n)
{
//Problem Desc: Multilpy two matrices
//Input: Matrix A and Matrix B
//Output: Matrix C
for i := 1 to n do
for j := 1 to n do
C[i][j] := 0;
for k := 1 to n do
C[i][j] := C[i][j] + A[i][k] * B[k][j];
}
Fundamentals of analysis of algorithms
• The efficiency of an algorithm can be decided by
measuring the performance of an algorithm.
• We can measure the performance of an algorithm by
computing two factors
– Amount of time required by an algorithm to execute (time
complexity)
– Amount of storage required by an algorithm (space
complexity)
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Space Complexity
• Space complexity can be defined as amount of memory
required by an algorithm to run.
• To compute space complexity we use two factors : constant
space and variable space
• Constant space includes instructions, variables and constants
• Variable space includes dynamic allocations, function recursion.
• Space requirement, s(p) = C + sp
• sp is the space dependent upon instance characteristics.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Time Complexity
• The time complexity of an algorithm is the amount of computer
time required by an algorithm to run complete the task.
• The time complexity, T(p), taken by a program p is the sum of
the compile time and the run time.
• Total Time, T(p) = compile time + run (execution) time
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Asymptotic Notations:
• To choose the best algorithm, we need to check efficiency of
each algorithm.
• Efficiency can be measured by computing space and time
complexity.
• So, Asymptotic notation is a shorthand way to represent the
time complexity.
• Using asymptotic notations we can give time complexity as
“fastest possible”, “slowest possible” or “average time”.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Big Oh Notation:
• Denoted by ‘O’
• Method if representing upper time of representing the upper
bound of algorithms running time.
• Using big Oh notation we can give longest amount of time taken
by the algorithm to complete.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Omega Notation:
• Denoted by ‘Ω’
• It is used to represent the lower bound of algorithm running
time.
• Using omega (Ω) notation we can denote shortest amount of
time taken by algorithm.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Theta Notation:
• Denoted by ‘Θ’
• By this method the running time is between upper bound and
lower bound.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Data Structure
• Data may be organized in many different ways.
• A data structure is a arrangement of data in a
computer memory or on a disk.
• The logical or mathematical model of a particular
organization of data is called data structure.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Data Structure
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Data Structure Operation
Data appearing in data structures are processed by
means of operations.
Operations are:
•Traversing: Accessing each record exactly once so that
certain items in the record may be processed.
•Searching: Finding the location of the record with a
given key value, or finding the locations of all records
which satisfy one or more conditions.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Data Structure Operation
• Inserting: Adding the new record to the structure.
• Deleting: Removing a record from the structure.
Special operations:
• Sorting: Arranging the records in some logical order
• Merging: Combining the records in two-different
sorted files into a single-sorted file.
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Linear
1. Array:
2. Stack
3. Queue
4. Linked List
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Array
• An array is a collection of homogeneous type of data
elements.
• An array is consisting of a collection of elements .
• Operation Performed On Array:
1. Traversing
2. Search
3. Insertion
4. Deletion
5. Sorting
6. Merging
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
1
2
3
4
5
Representation of array
Stack
• A Stack is a list of elements in which an element may
be inserted or deleted at one end which is known as
TOP of the stack.
• Operation Performed On Array:
1. Push: add an element in stack
2. Pop: remove an element in stack
3. Peek :Current processed element
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
a
b
c TOP
Queue
• A queue is a linear list of element in which insertion
can be done at one end which is known as REAR and
deletion can be done which is known as FRONT.
• Operation:
1. Insertion : add a new element in queue
2. Deletion: Removing an element in queue
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Queue
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Linked List
• A Linked list is a linear collection of data elements .
• It has two part one is info and other is link part.
• info part gives information and link part is address of
next node
• Operation:
1. Traversing
2. Searching
3. Insertion
4. Deletion
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Non-Linear
1. Graph
2. Tree
3. Table
4. Set
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Graph
• A graph is a collection of sets V and E where V is a
finite non-empty set of vertices and E is finite non-
empty set of edges.
• Vertices – node in graph
• Edges – Two adjacent nodes are joined by edges.
• Graph G = {V, E}
• Operation:
1. Insertion
2. Deletion
3. Searching
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Tree
• Tree is a finite set of one or more nodes such that
– There is a specially designed node called root.
– The remaining nodes are partitioned into n>=0 disjoint sets T1, T2, T3,
…., Tn are called the sub-trees of the Root.
• Operation:
1. Insertion
2. Deletion
3. Searching
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Tables
• This is kind of data structure plays an important role in
information retrieval.
• Types of tables:
– Rectangular
– Jagged
– Inverted
– Hash
• Operation:
1. Insertion
2. Deletion
3. Searching
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Key Value
0 “Abc”
1 “Pqr”
Sets
• Heap is a complete binary tree
Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
Q & A

More Related Content

What's hot (19)

PPT
7. Multithreading
Nilesh Dalvi
 
PPT
11. Arrays
Nilesh Dalvi
 
PPT
Polymorphism
Nilesh Dalvi
 
PPT
14. Linked List
Nilesh Dalvi
 
PDF
Wrapper classes
Ravi_Kant_Sahu
 
PPSX
Arrays in Java
Hitesh-Java
 
PPTX
Java 103 intro to java data structures
agorolabs
 
PDF
String handling(string buffer class)
Ravi Kant Sahu
 
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
PDF
List classes
Ravi_Kant_Sahu
 
PDF
Core java complete notes - Contact at +91-814-614-5674
Lokesh Kakkar Mobile No. 814-614-5674
 
PPTX
Object-oriented programming
Neelesh Shukla
 
PDF
Generics
Ravi_Kant_Sahu
 
PPTX
Object Oriented Programming Concepts
Bhushan Nagaraj
 
PPT
Object Oriented Programming Concepts using Java
Glenn Guden
 
PPTX
Session 05 - Strings in Java
PawanMM
 
PPT
Inheritance : Extending Classes
Nilesh Dalvi
 
PDF
Farhaan Ahmed, BCA 2nd Year
dezyneecole
 
PPTX
05 Java Language And OOP Part V
Hari Christian
 
7. Multithreading
Nilesh Dalvi
 
11. Arrays
Nilesh Dalvi
 
Polymorphism
Nilesh Dalvi
 
14. Linked List
Nilesh Dalvi
 
Wrapper classes
Ravi_Kant_Sahu
 
Arrays in Java
Hitesh-Java
 
Java 103 intro to java data structures
agorolabs
 
String handling(string buffer class)
Ravi Kant Sahu
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
List classes
Ravi_Kant_Sahu
 
Core java complete notes - Contact at +91-814-614-5674
Lokesh Kakkar Mobile No. 814-614-5674
 
Object-oriented programming
Neelesh Shukla
 
Generics
Ravi_Kant_Sahu
 
Object Oriented Programming Concepts
Bhushan Nagaraj
 
Object Oriented Programming Concepts using Java
Glenn Guden
 
Session 05 - Strings in Java
PawanMM
 
Inheritance : Extending Classes
Nilesh Dalvi
 
Farhaan Ahmed, BCA 2nd Year
dezyneecole
 
05 Java Language And OOP Part V
Hari Christian
 

Viewers also liked (14)

PPT
6. Exception Handling
Nilesh Dalvi
 
PPT
5. Inheritances, Packages and Intefaces
Nilesh Dalvi
 
PPTX
MEDIO AMBIENTE
jennifer0112
 
DOCX
Color clipping
Color Clipping
 
PPTX
Presentation for handyman
steven cornett
 
PPS
Palacio Gyeongbokgung (Seoul)
F. Ovies
 
PPTX
Partes del computador
Camilo Ospina
 
DOCX
Liderazgo terminado
Melissa Granados Fonseca
 
PDF
презентация от РПК групп
Igor Levchuk
 
PPTX
Ntick tecnología
Martina Ibarra
 
PPTX
Ciudadanía digital
Francisco Donoso
 
PPT
Token03
Sriniti Jessica
 
PPT
Strings
Nilesh Dalvi
 
PDF
Devcommerce 2016: Migração plataforma Magazine Luiza e seu laboratório de in...
André Fatala
 
6. Exception Handling
Nilesh Dalvi
 
5. Inheritances, Packages and Intefaces
Nilesh Dalvi
 
MEDIO AMBIENTE
jennifer0112
 
Color clipping
Color Clipping
 
Presentation for handyman
steven cornett
 
Palacio Gyeongbokgung (Seoul)
F. Ovies
 
Partes del computador
Camilo Ospina
 
Liderazgo terminado
Melissa Granados Fonseca
 
презентация от РПК групп
Igor Levchuk
 
Ntick tecnología
Martina Ibarra
 
Ciudadanía digital
Francisco Donoso
 
Strings
Nilesh Dalvi
 
Devcommerce 2016: Migração plataforma Magazine Luiza e seu laboratório de in...
André Fatala
 
Ad

Similar to 10. Introduction to Datastructure (20)

PPTX
DATA STRUCTURES unit 1.pptx
ShivamKrPathak
 
PPTX
Algorithm Complexity and Main Concepts
Adelina Ahadova
 
PPTX
Data structure using c module 1
smruti sarangi
 
PPT
Ch 1 intriductions
irshad17
 
PPTX
data structures using C 2 sem BCA univeristy of mysore
ambikavenkatesh2
 
PPTX
Introduction to data structures and its types
sonalishinge2015
 
PDF
DATA STRUCTURE
RobinRohit2
 
PDF
DATA STRUCTURE.pdf
ibrahim386946
 
PDF
Unit 1 OF DS FOR AI DS BTRCH OF DS FOR AI DS BTRCH .pdf
prathamsingh33
 
PPTX
introduction to data structures and types
ankita946617
 
PDF
DSA
rrupa2
 
PDF
Data Structures (BE)
PRABHAHARAN429
 
PPTX
CSE 443 (1).pptx
JayaKrishna636858
 
PDF
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Axmedcarb
 
PDF
Data Structure - Lecture 1 - Introduction.pdf
donotreply20
 
PPTX
data structures power point presentation
cselt2403
 
PDF
Lec01-Algorithems - Introduction and Overview.pdf
MAJDABDALLAH3
 
PDF
Elementary data structure
Biswajit Mandal
 
PPTX
Array Data StructureData StructureData Structure.pptx
menukam354
 
DATA STRUCTURES unit 1.pptx
ShivamKrPathak
 
Algorithm Complexity and Main Concepts
Adelina Ahadova
 
Data structure using c module 1
smruti sarangi
 
Ch 1 intriductions
irshad17
 
data structures using C 2 sem BCA univeristy of mysore
ambikavenkatesh2
 
Introduction to data structures and its types
sonalishinge2015
 
DATA STRUCTURE
RobinRohit2
 
DATA STRUCTURE.pdf
ibrahim386946
 
Unit 1 OF DS FOR AI DS BTRCH OF DS FOR AI DS BTRCH .pdf
prathamsingh33
 
introduction to data structures and types
ankita946617
 
DSA
rrupa2
 
Data Structures (BE)
PRABHAHARAN429
 
CSE 443 (1).pptx
JayaKrishna636858
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Axmedcarb
 
Data Structure - Lecture 1 - Introduction.pdf
donotreply20
 
data structures power point presentation
cselt2403
 
Lec01-Algorithems - Introduction and Overview.pdf
MAJDABDALLAH3
 
Elementary data structure
Biswajit Mandal
 
Array Data StructureData StructureData Structure.pptx
menukam354
 
Ad

More from Nilesh Dalvi (9)

PPT
2. Basics of Java
Nilesh Dalvi
 
PPT
Templates
Nilesh Dalvi
 
PPT
File handling
Nilesh Dalvi
 
PPT
Input and output in C++
Nilesh Dalvi
 
PPT
Operator Overloading
Nilesh Dalvi
 
PDF
Constructors and destructors
Nilesh Dalvi
 
PDF
Classes and objects
Nilesh Dalvi
 
PDF
Introduction to cpp
Nilesh Dalvi
 
PDF
Introduction to oops concepts
Nilesh Dalvi
 
2. Basics of Java
Nilesh Dalvi
 
Templates
Nilesh Dalvi
 
File handling
Nilesh Dalvi
 
Input and output in C++
Nilesh Dalvi
 
Operator Overloading
Nilesh Dalvi
 
Constructors and destructors
Nilesh Dalvi
 
Classes and objects
Nilesh Dalvi
 
Introduction to cpp
Nilesh Dalvi
 
Introduction to oops concepts
Nilesh Dalvi
 

Recently uploaded (20)

PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PDF
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
How to Handle Salesperson Commision in Odoo 18 Sales
Celine George
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
community health nursing question paper 2.pdf
Prince kumar
 
Lesson 2 - WATER,pH, BUFFERS, AND ACID-BASE.pdf
marvinnbustamante1
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 

10. Introduction to Datastructure

  • 1. Introduction to Algorithms By Nilesh Dalvi Lecturer, Patkar-Varde College.Lecturer, Patkar-Varde College. http://www.slideshare.net/nileshdalvi01 Java and DataJava and Data StructuresStructures
  • 2. Algorithm The algorithm is defined as the a collection of unambiguous instructions occurring in some specific sequence and such an algorithm should produce output for given set of input in finite amount of time. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 3. Algorithm • write an algorithm to count the sum of n numbers Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W). Algorithm sum (1, n) { //Problem Desc: Algorithm for finding sum of n numbers //Input: 1 to n numbers //Output: Sum of n numbers result := 0; for i:= 1 to n do i:= i + 1 result := result + i; }
  • 4. Algorithm • write an algorithm to check whether the given no is even or odd. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W). Algorithm EvenOddTest(val) { //Problem Desc: Algorithm for checking whether the given no is even or odd. //Input: 1 to n number //Output: Even or odd number if(val % 2 == 0) write("No is even"); esle write ("No is odd"); }
  • 5. Algorithm • write an algorithm for sorting the given elements Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W). Algorithm Sort (a, n) { //Problem Desc: Algorithm for sorting the elements. //Input: An array //Output: Sorted array for i:=1 to n do { for j:= i +1 to n-1 do { if(a[i]) > a[j]) then { temp := a[i]; a[i] := a[j]; a[j] := temp; } } write("List is sorted!"); } }
  • 6. Algorithm • write an algorithm for calculating factorial of n numbers Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W). Algorithm factCalc (n) { //Problem Desc: For calculating factorial of given no //Input: Number //Output: Factorial of given number if n := 1 then return 1; else return n * factCalc(n - 1); }
  • 7. Algorithm • write an algorithm for multiply two matrices Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W). Algorithm mulMatrix (A, B, n) { //Problem Desc: Multilpy two matrices //Input: Matrix A and Matrix B //Output: Matrix C for i := 1 to n do for j := 1 to n do C[i][j] := 0; for k := 1 to n do C[i][j] := C[i][j] + A[i][k] * B[k][j]; }
  • 8. Fundamentals of analysis of algorithms • The efficiency of an algorithm can be decided by measuring the performance of an algorithm. • We can measure the performance of an algorithm by computing two factors – Amount of time required by an algorithm to execute (time complexity) – Amount of storage required by an algorithm (space complexity) Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 9. Space Complexity • Space complexity can be defined as amount of memory required by an algorithm to run. • To compute space complexity we use two factors : constant space and variable space • Constant space includes instructions, variables and constants • Variable space includes dynamic allocations, function recursion. • Space requirement, s(p) = C + sp • sp is the space dependent upon instance characteristics. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 10. Time Complexity • The time complexity of an algorithm is the amount of computer time required by an algorithm to run complete the task. • The time complexity, T(p), taken by a program p is the sum of the compile time and the run time. • Total Time, T(p) = compile time + run (execution) time Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 11. Asymptotic Notations: • To choose the best algorithm, we need to check efficiency of each algorithm. • Efficiency can be measured by computing space and time complexity. • So, Asymptotic notation is a shorthand way to represent the time complexity. • Using asymptotic notations we can give time complexity as “fastest possible”, “slowest possible” or “average time”. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 12. Big Oh Notation: • Denoted by ‘O’ • Method if representing upper time of representing the upper bound of algorithms running time. • Using big Oh notation we can give longest amount of time taken by the algorithm to complete. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 13. Omega Notation: • Denoted by ‘Ω’ • It is used to represent the lower bound of algorithm running time. • Using omega (Ω) notation we can denote shortest amount of time taken by algorithm. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 14. Theta Notation: • Denoted by ‘Θ’ • By this method the running time is between upper bound and lower bound. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 15. Data Structure • Data may be organized in many different ways. • A data structure is a arrangement of data in a computer memory or on a disk. • The logical or mathematical model of a particular organization of data is called data structure. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 16. Data Structure Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 17. Data Structure Operation Data appearing in data structures are processed by means of operations. Operations are: •Traversing: Accessing each record exactly once so that certain items in the record may be processed. •Searching: Finding the location of the record with a given key value, or finding the locations of all records which satisfy one or more conditions. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 18. Data Structure Operation • Inserting: Adding the new record to the structure. • Deleting: Removing a record from the structure. Special operations: • Sorting: Arranging the records in some logical order • Merging: Combining the records in two-different sorted files into a single-sorted file. Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 19. Linear 1. Array: 2. Stack 3. Queue 4. Linked List Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 20. Array • An array is a collection of homogeneous type of data elements. • An array is consisting of a collection of elements . • Operation Performed On Array: 1. Traversing 2. Search 3. Insertion 4. Deletion 5. Sorting 6. Merging Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W). 1 2 3 4 5 Representation of array
  • 21. Stack • A Stack is a list of elements in which an element may be inserted or deleted at one end which is known as TOP of the stack. • Operation Performed On Array: 1. Push: add an element in stack 2. Pop: remove an element in stack 3. Peek :Current processed element Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W). a b c TOP
  • 22. Queue • A queue is a linear list of element in which insertion can be done at one end which is known as REAR and deletion can be done which is known as FRONT. • Operation: 1. Insertion : add a new element in queue 2. Deletion: Removing an element in queue Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 24. Linked List • A Linked list is a linear collection of data elements . • It has two part one is info and other is link part. • info part gives information and link part is address of next node • Operation: 1. Traversing 2. Searching 3. Insertion 4. Deletion Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 25. Non-Linear 1. Graph 2. Tree 3. Table 4. Set Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 26. Graph • A graph is a collection of sets V and E where V is a finite non-empty set of vertices and E is finite non- empty set of edges. • Vertices – node in graph • Edges – Two adjacent nodes are joined by edges. • Graph G = {V, E} • Operation: 1. Insertion 2. Deletion 3. Searching Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 27. Tree • Tree is a finite set of one or more nodes such that – There is a specially designed node called root. – The remaining nodes are partitioned into n>=0 disjoint sets T1, T2, T3, …., Tn are called the sub-trees of the Root. • Operation: 1. Insertion 2. Deletion 3. Searching Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 28. Tables • This is kind of data structure plays an important role in information retrieval. • Types of tables: – Rectangular – Jagged – Inverted – Hash • Operation: 1. Insertion 2. Deletion 3. Searching Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W). Key Value 0 “Abc” 1 “Pqr”
  • 29. Sets • Heap is a complete binary tree Nilesh Dalvi, Lecturer@Patkar-Varde College, Goregaon(W).
  • 30. Q & A