SlideShare a Scribd company logo
1 of 11
BY,
LAKSHMI.S,
ASSISTANT PROFESSOR,
DEPARTMENT OF COMPUTER SCIENCE,
SRI ADI CHUNCHANAGIRI WOMEN’S COLLEGE, CUMBUM.
A data structure is a specialized format for organizing, processing,
retrieving and storing data. There are several basic and advanced
types of data structures, all designed to arrange data to suit a
specific purpose. Data structures make it easy for users to access
and work with the data they need in appropriate ways.
 The valid algorithm takes a finite amount of time for execution. The time
required by the algorithm to solve given problem is called time
complexity of the algorithm. Time complexity is very useful measure in
algorithm analysis.
 It is the time needed for the completion of an algorithm. To estimate the
time complexity, we need to consider the cost of each fundamental
instruction and the number of times the instruction is executed.
 Problem-solving using computer requires memory to hold temporary data or
final result while the program is in execution. The amount of memory
required by the algorithm to solve given problem is called space
complexity of the algorithm.
 The space complexity of an algorithm quantifies the amount of space taken
by an algorithm to run as a function of the length of the input. Consider an
example: Suppose a problem to find the frequency of array elements.
 It is the amount of memory needed for the completion of an
algorithm.
 To estimate the memory requirement we need to focus on two parts:
 (1) A fixed part: It is independent of the input size. It includes
memory for instructions (code), constants, variables, etc.
 (2) A variable part: It is dependent on the input size. It includes
memory for recursion stack, referenced variables, etc.
Aspect Time Complexity Space Complexity
Definition
Measures the execution time of an algorithm relative
to input size.
Measures the memory usage of an algorithm relative to input
size.
Focus Amount of time an algorithm takes to complete.
Amount of memory (RAM) an algorithm requires for
execution.
Primary Concern Efficiency in terms of time. Efficiency in terms of memory usage.
Analysis Approach
Number of operations or computational steps
relative to input size.
Memory allocation for variables, data structures, and function
calls relative to input size.
Input Size Impact Larger inputs usually lead to longer execution times.
Larger inputs may require more memory for storing data
structures or managing recursion.
Optimization Goal
Reducing the number of computational operations or
steps.
Minimizing the amount of memory needed for data storage and
processing.
Typical Example
Finding an element using binary search (O(log n)
time complexity).
Creating a 2D array of size n x n (O(n²) space complexity).
An array is a powerful data structure that allows users to store and
manipulate a collection of elements, all of the same data type in a single
variable. Simply, it is a collection of elements of the same data type
stored at contagious memory locations that can be randomly accessed
with their index number. It’s one of the most popular and simple data
structures and is often used to implement other data structures
like stacks and queues.
There are some of the properties of an array that are listed as follows
 Each element in an array is of the same data type and carries the same size that is 4
bytes.
 Elements in the array are stored at contiguous memory locations from which the first
element is stored at the smallest memory location.
 Elements of the array can be randomly accessed since we can calculate the address of
each element of the array with the given base address and the size of the data element.
Different applications of an array are as follows:
• An array is used in solving matrix problems.
• Database records are also implemented by an array.
• It helps in implementing a sorting algorithm.
• It is also used to implement other data structures like Stacks, Queues,
Heaps, Hash tables, etc.
• An array can be used for CPU scheduling.
• Can be applied as a lookup table in computers.
• Arrays can be used in speech processing where every speech signal is an array.
• The screen of the computer is also displayed by an array. Here we use a multidimensional
array.
• The array is used in many management systems like a library, students, parliament, etc.
• The array is used in the online ticket booking system. Contacts on a cell phone are
displayed by this array.
• In games like online chess, where the player can store his past moves as well as current
moves. It indicates a hint of position.
• To save images in a specific dimension in the android Like 360*1200

More Related Content

What's hot (20)

The Relational Model
The Relational ModelThe Relational Model
The Relational Model
 
Files Vs DataBase
Files Vs DataBaseFiles Vs DataBase
Files Vs DataBase
 
File organisation in system analysis and design
File organisation in system analysis and designFile organisation in system analysis and design
File organisation in system analysis and design
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Priority Queue in Data Structure
Priority Queue in Data StructurePriority Queue in Data Structure
Priority Queue in Data Structure
 
Wk 1 - File organization.pptx
Wk 1 - File organization.pptxWk 1 - File organization.pptx
Wk 1 - File organization.pptx
 
Database Security
Database SecurityDatabase Security
Database Security
 
Os presentation
Os presentationOs presentation
Os presentation
 
Advanced DBMS presentation
Advanced DBMS presentationAdvanced DBMS presentation
Advanced DBMS presentation
 
Lecture 2: Information system
Lecture 2: Information systemLecture 2: Information system
Lecture 2: Information system
 
Hospital Management system Database design
Hospital Management system Database designHospital Management system Database design
Hospital Management system Database design
 
B+ tree
B+ treeB+ tree
B+ tree
 
OS file systems
OS file systemsOS file systems
OS file systems
 
Physical Database Design & Performance
Physical Database Design & PerformancePhysical Database Design & Performance
Physical Database Design & Performance
 
Database security
Database security Database security
Database security
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisation
 
Data Management
Data Management Data Management
Data Management
 
Algoritmo de quicksort
Algoritmo de quicksortAlgoritmo de quicksort
Algoritmo de quicksort
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Memory management
Memory managementMemory management
Memory management
 

Similar to DataSructure-Time and Space Complexity.pptx

Similar to DataSructure-Time and Space Complexity.pptx (20)

Data structure introduction
Data structure introductionData structure introduction
Data structure introduction
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
 
Bab 4
Bab 4Bab 4
Bab 4
 
Intro to DS.pptx
Intro to DS.pptxIntro to DS.pptx
Intro to DS.pptx
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Cs 331 Data Structures
 
OSCh9
OSCh9OSCh9
OSCh9
 
Ch9 OS
Ch9 OSCh9 OS
Ch9 OS
 
OS_Ch9
OS_Ch9OS_Ch9
OS_Ch9
 
Chapter 1( intro & overview)
Chapter 1( intro & overview)Chapter 1( intro & overview)
Chapter 1( intro & overview)
 
Ch8
Ch8Ch8
Ch8
 
complexity.pptx
complexity.pptxcomplexity.pptx
complexity.pptx
 
Data structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdfData structures and algorithms Module-1.pdf
Data structures and algorithms Module-1.pdf
 
Lect1.pptx
Lect1.pptxLect1.pptx
Lect1.pptx
 
Introduction of data structure
Introduction of data structureIntroduction of data structure
Introduction of data structure
 
Chapter 8 - Main Memory
Chapter 8 - Main MemoryChapter 8 - Main Memory
Chapter 8 - Main Memory
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
Unit 1 dsa
Unit 1 dsaUnit 1 dsa
Unit 1 dsa
 
Analysis of Algorithms_RR.pptx
Analysis of Algorithms_RR.pptxAnalysis of Algorithms_RR.pptx
Analysis of Algorithms_RR.pptx
 

More from LakshmiSamivel

Greedy Algorithm for Computer Science.ppt
Greedy Algorithm for Computer Science.pptGreedy Algorithm for Computer Science.ppt
Greedy Algorithm for Computer Science.pptLakshmiSamivel
 
General methodin Data Structure for UG.pptx
General methodin Data Structure for UG.pptxGeneral methodin Data Structure for UG.pptx
General methodin Data Structure for UG.pptxLakshmiSamivel
 
DIVIDE AND CONQUERMETHOD IN DATASTRUCTURE.pptx
DIVIDE AND CONQUERMETHOD IN DATASTRUCTURE.pptxDIVIDE AND CONQUERMETHOD IN DATASTRUCTURE.pptx
DIVIDE AND CONQUERMETHOD IN DATASTRUCTURE.pptxLakshmiSamivel
 
Classification of datastructure.ppt
Classification of datastructure.pptClassification of datastructure.ppt
Classification of datastructure.pptLakshmiSamivel
 
Computer network notes
Computer network notesComputer network notes
Computer network notesLakshmiSamivel
 

More from LakshmiSamivel (14)

Greedy Algorithm for Computer Science.ppt
Greedy Algorithm for Computer Science.pptGreedy Algorithm for Computer Science.ppt
Greedy Algorithm for Computer Science.ppt
 
General methodin Data Structure for UG.pptx
General methodin Data Structure for UG.pptxGeneral methodin Data Structure for UG.pptx
General methodin Data Structure for UG.pptx
 
DIVIDE AND CONQUERMETHOD IN DATASTRUCTURE.pptx
DIVIDE AND CONQUERMETHOD IN DATASTRUCTURE.pptxDIVIDE AND CONQUERMETHOD IN DATASTRUCTURE.pptx
DIVIDE AND CONQUERMETHOD IN DATASTRUCTURE.pptx
 
Presentation DM.pptx
Presentation DM.pptxPresentation DM.pptx
Presentation DM.pptx
 
Dos.pptx
Dos.pptxDos.pptx
Dos.pptx
 
Formatting tags
Formatting tagsFormatting tags
Formatting tags
 
Classification of datastructure.ppt
Classification of datastructure.pptClassification of datastructure.ppt
Classification of datastructure.ppt
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
Semaphore
Semaphore Semaphore
Semaphore
 
Firewall ppt
Firewall pptFirewall ppt
Firewall ppt
 
View
ViewView
View
 
Procedures andcursors
Procedures andcursorsProcedures andcursors
Procedures andcursors
 
Computer network notes
Computer network notesComputer network notes
Computer network notes
 
OsI reference model
OsI reference modelOsI reference model
OsI reference model
 

Recently uploaded

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 

Recently uploaded (20)

Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 

DataSructure-Time and Space Complexity.pptx

  • 1. BY, LAKSHMI.S, ASSISTANT PROFESSOR, DEPARTMENT OF COMPUTER SCIENCE, SRI ADI CHUNCHANAGIRI WOMEN’S COLLEGE, CUMBUM.
  • 2. A data structure is a specialized format for organizing, processing, retrieving and storing data. There are several basic and advanced types of data structures, all designed to arrange data to suit a specific purpose. Data structures make it easy for users to access and work with the data they need in appropriate ways.
  • 3.  The valid algorithm takes a finite amount of time for execution. The time required by the algorithm to solve given problem is called time complexity of the algorithm. Time complexity is very useful measure in algorithm analysis.  It is the time needed for the completion of an algorithm. To estimate the time complexity, we need to consider the cost of each fundamental instruction and the number of times the instruction is executed.
  • 4.  Problem-solving using computer requires memory to hold temporary data or final result while the program is in execution. The amount of memory required by the algorithm to solve given problem is called space complexity of the algorithm.  The space complexity of an algorithm quantifies the amount of space taken by an algorithm to run as a function of the length of the input. Consider an example: Suppose a problem to find the frequency of array elements.
  • 5.  It is the amount of memory needed for the completion of an algorithm.  To estimate the memory requirement we need to focus on two parts:  (1) A fixed part: It is independent of the input size. It includes memory for instructions (code), constants, variables, etc.  (2) A variable part: It is dependent on the input size. It includes memory for recursion stack, referenced variables, etc.
  • 6. Aspect Time Complexity Space Complexity Definition Measures the execution time of an algorithm relative to input size. Measures the memory usage of an algorithm relative to input size. Focus Amount of time an algorithm takes to complete. Amount of memory (RAM) an algorithm requires for execution. Primary Concern Efficiency in terms of time. Efficiency in terms of memory usage. Analysis Approach Number of operations or computational steps relative to input size. Memory allocation for variables, data structures, and function calls relative to input size. Input Size Impact Larger inputs usually lead to longer execution times. Larger inputs may require more memory for storing data structures or managing recursion. Optimization Goal Reducing the number of computational operations or steps. Minimizing the amount of memory needed for data storage and processing. Typical Example Finding an element using binary search (O(log n) time complexity). Creating a 2D array of size n x n (O(n²) space complexity).
  • 7. An array is a powerful data structure that allows users to store and manipulate a collection of elements, all of the same data type in a single variable. Simply, it is a collection of elements of the same data type stored at contagious memory locations that can be randomly accessed with their index number. It’s one of the most popular and simple data structures and is often used to implement other data structures like stacks and queues.
  • 8.
  • 9. There are some of the properties of an array that are listed as follows  Each element in an array is of the same data type and carries the same size that is 4 bytes.  Elements in the array are stored at contiguous memory locations from which the first element is stored at the smallest memory location.  Elements of the array can be randomly accessed since we can calculate the address of each element of the array with the given base address and the size of the data element.
  • 10. Different applications of an array are as follows: • An array is used in solving matrix problems. • Database records are also implemented by an array. • It helps in implementing a sorting algorithm. • It is also used to implement other data structures like Stacks, Queues, Heaps, Hash tables, etc. • An array can be used for CPU scheduling. • Can be applied as a lookup table in computers.
  • 11. • Arrays can be used in speech processing where every speech signal is an array. • The screen of the computer is also displayed by an array. Here we use a multidimensional array. • The array is used in many management systems like a library, students, parliament, etc. • The array is used in the online ticket booking system. Contacts on a cell phone are displayed by this array. • In games like online chess, where the player can store his past moves as well as current moves. It indicates a hint of position. • To save images in a specific dimension in the android Like 360*1200