SlideShare a Scribd company logo
In any given function in java, what do I need to look for in order to determine its space
complexity? thank you
Solution
You need to identify that is there any type of memory your creating locally in function to process
current execution of the function.
Type of memory generally can be created in function are:
1. local variables . ex int a, double y, String z etc : Space complexity : O(1) => constant
2. An Array, ArrayList, LinkedList, HashMap etc of size K => Space complexity : O(k)
For example:
void merge(int arr[], int l, int m, int r)
{
// Find sizes of two subarrays to be merged
int n1 = m - l + 1;
int n2 = r - m;
/* Create temp arrays */
int L[] = new int [n1]; // WE ARE CREATING EXTRA MEMORY
int R[] = new int [n2]; // WE ARE CREATING EXTRA MEMORY
/*Copy data to temp arrays*/
for (int i=0; i

More Related Content

Similar to In any given function in java, what do I need to look for in order t.pdf

Python 培训讲义
Python 培训讲义Python 培训讲义
Python 培训讲义
leejd
 
Java
JavaJava
Clojure made really really simple
Clojure made really really simpleClojure made really really simple
Clojure made really really simple
John Stevenson
 
Flying Futures at the same sky can make the sun rise at midnight
Flying Futures at the same sky can make the sun rise at midnightFlying Futures at the same sky can make the sun rise at midnight
Flying Futures at the same sky can make the sun rise at midnight
Wiem Zine Elabidine
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Codemotion
 
TeraSort
TeraSortTeraSort
TeraSort
Tung D. Le
 
nlp dl 1.pdf
nlp dl 1.pdfnlp dl 1.pdf
nlp dl 1.pdf
nyomans1
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
elliando dias
 
Class 32: Interpreters
Class 32: InterpretersClass 32: Interpreters
Class 32: Interpreters
David Evans
 
C# programming
C# programming C# programming
C# programming
umesh patil
 
Space Complexity in Data Structure.docx
Space Complexity in Data Structure.docxSpace Complexity in Data Structure.docx
Space Complexity in Data Structure.docx
Mani .S (Specialization in Semantic Web)
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
Devnology
 
Write Your Own JVM Compiler
Write Your Own JVM CompilerWrite Your Own JVM Compiler
Write Your Own JVM Compiler
Erin Dees
 
Hw09 Hadoop + Clojure
Hw09   Hadoop + ClojureHw09   Hadoop + Clojure
Hw09 Hadoop + Clojure
Cloudera, Inc.
 
Clojure made simple - Lightning talk
Clojure made simple - Lightning talkClojure made simple - Lightning talk
Clojure made simple - Lightning talk
John Stevenson
 
Intro to threp
Intro to threpIntro to threp
Intro to threp
Hong Wu
 
Numpy Talk at SIAM
Numpy Talk at SIAMNumpy Talk at SIAM
Numpy Talk at SIAM
Enthought, Inc.
 

Similar to In any given function in java, what do I need to look for in order t.pdf (17)

Python 培训讲义
Python 培训讲义Python 培训讲义
Python 培训讲义
 
Java
JavaJava
Java
 
Clojure made really really simple
Clojure made really really simpleClojure made really really simple
Clojure made really really simple
 
Flying Futures at the same sky can make the sun rise at midnight
Flying Futures at the same sky can make the sun rise at midnightFlying Futures at the same sky can make the sun rise at midnight
Flying Futures at the same sky can make the sun rise at midnight
 
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
Functional Programming You Already Know - Kevlin Henney - Codemotion Rome 2015
 
TeraSort
TeraSortTeraSort
TeraSort
 
nlp dl 1.pdf
nlp dl 1.pdfnlp dl 1.pdf
nlp dl 1.pdf
 
Hadoop + Clojure
Hadoop + ClojureHadoop + Clojure
Hadoop + Clojure
 
Class 32: Interpreters
Class 32: InterpretersClass 32: Interpreters
Class 32: Interpreters
 
C# programming
C# programming C# programming
C# programming
 
Space Complexity in Data Structure.docx
Space Complexity in Data Structure.docxSpace Complexity in Data Structure.docx
Space Complexity in Data Structure.docx
 
Learn a language : LISP
Learn a language : LISPLearn a language : LISP
Learn a language : LISP
 
Write Your Own JVM Compiler
Write Your Own JVM CompilerWrite Your Own JVM Compiler
Write Your Own JVM Compiler
 
Hw09 Hadoop + Clojure
Hw09   Hadoop + ClojureHw09   Hadoop + Clojure
Hw09 Hadoop + Clojure
 
Clojure made simple - Lightning talk
Clojure made simple - Lightning talkClojure made simple - Lightning talk
Clojure made simple - Lightning talk
 
Intro to threp
Intro to threpIntro to threp
Intro to threp
 
Numpy Talk at SIAM
Numpy Talk at SIAMNumpy Talk at SIAM
Numpy Talk at SIAM
 

More from neetuarya13

Find the total cost of making a triangular sail that has a base dime.pdf
Find the total cost of making a triangular sail that has a base dime.pdfFind the total cost of making a triangular sail that has a base dime.pdf
Find the total cost of making a triangular sail that has a base dime.pdf
neetuarya13
 
Explain Charge, Current, Volta Power and Energy. Also explain relatio.pdf
Explain Charge, Current, Volta Power and Energy. Also explain relatio.pdfExplain Charge, Current, Volta Power and Energy. Also explain relatio.pdf
Explain Charge, Current, Volta Power and Energy. Also explain relatio.pdf
neetuarya13
 
Define Managerial Accounting. Why do managers utilize managerial acc.pdf
Define Managerial Accounting. Why do managers utilize managerial acc.pdfDefine Managerial Accounting. Why do managers utilize managerial acc.pdf
Define Managerial Accounting. Why do managers utilize managerial acc.pdf
neetuarya13
 
Describe how a third-generation language (3GL) programming language .pdf
Describe how a third-generation language (3GL) programming language .pdfDescribe how a third-generation language (3GL) programming language .pdf
Describe how a third-generation language (3GL) programming language .pdf
neetuarya13
 
Biologists have very specific terminology (thats one of the things.pdf
Biologists have very specific terminology (thats one of the things.pdfBiologists have very specific terminology (thats one of the things.pdf
Biologists have very specific terminology (thats one of the things.pdf
neetuarya13
 
Bacteria Characteristics Indole oxidase VP Cell Catalase reaction Sha.pdf
Bacteria Characteristics Indole oxidase VP Cell Catalase reaction Sha.pdfBacteria Characteristics Indole oxidase VP Cell Catalase reaction Sha.pdf
Bacteria Characteristics Indole oxidase VP Cell Catalase reaction Sha.pdf
neetuarya13
 
All of the following interactions can help hold the tertiary structur.pdf
All of the following interactions can help hold the tertiary structur.pdfAll of the following interactions can help hold the tertiary structur.pdf
All of the following interactions can help hold the tertiary structur.pdf
neetuarya13
 
According to the figure below, which of the following statements reg.pdf
According to the figure below, which of the following statements reg.pdfAccording to the figure below, which of the following statements reg.pdf
According to the figure below, which of the following statements reg.pdf
neetuarya13
 
3. A plant breeder crosses an inbred soybean cultivar with herbicide.pdf
3. A plant breeder crosses an inbred soybean cultivar with herbicide.pdf3. A plant breeder crosses an inbred soybean cultivar with herbicide.pdf
3. A plant breeder crosses an inbred soybean cultivar with herbicide.pdf
neetuarya13
 
A mirror faces a cliff located some distance away. Mounted on the cli.pdf
A mirror faces a cliff located some distance away. Mounted on the cli.pdfA mirror faces a cliff located some distance away. Mounted on the cli.pdf
A mirror faces a cliff located some distance away. Mounted on the cli.pdf
neetuarya13
 
Why is it important to identify Classes early in the Unified Process.pdf
Why is it important to identify Classes early in the Unified Process.pdfWhy is it important to identify Classes early in the Unified Process.pdf
Why is it important to identify Classes early in the Unified Process.pdf
neetuarya13
 
A male Drosophila melanogaster has the genotype Aa; Bb; Cc; XDY..pdf
A male Drosophila melanogaster has the genotype Aa; Bb; Cc; XDY..pdfA male Drosophila melanogaster has the genotype Aa; Bb; Cc; XDY..pdf
A male Drosophila melanogaster has the genotype Aa; Bb; Cc; XDY..pdf
neetuarya13
 
Which of the following facilitated the endosymbiotic acquisition of .pdf
Which of the following facilitated the endosymbiotic acquisition of .pdfWhich of the following facilitated the endosymbiotic acquisition of .pdf
Which of the following facilitated the endosymbiotic acquisition of .pdf
neetuarya13
 
Which of the following is true about replication    The lagging s.pdf
Which of the following is true about replication    The lagging s.pdfWhich of the following is true about replication    The lagging s.pdf
Which of the following is true about replication    The lagging s.pdf
neetuarya13
 
Which is a common trait among all land plantsVascular tissues tra.pdf
Which is a common trait among all land plantsVascular tissues tra.pdfWhich is a common trait among all land plantsVascular tissues tra.pdf
Which is a common trait among all land plantsVascular tissues tra.pdf
neetuarya13
 
Which of the following is an example of company whose business model .pdf
Which of the following is an example of company whose business model .pdfWhich of the following is an example of company whose business model .pdf
Which of the following is an example of company whose business model .pdf
neetuarya13
 
what role(s) played by the Equatorial Segment Protein 1 (ESP1) durin.pdf
what role(s) played by the Equatorial Segment Protein 1 (ESP1) durin.pdfwhat role(s) played by the Equatorial Segment Protein 1 (ESP1) durin.pdf
what role(s) played by the Equatorial Segment Protein 1 (ESP1) durin.pdf
neetuarya13
 
What are the similarities and differences between simple linear regr.pdf
What are the similarities and differences between simple linear regr.pdfWhat are the similarities and differences between simple linear regr.pdf
What are the similarities and differences between simple linear regr.pdf
neetuarya13
 
What does it mean if a human female oocyte is no longer arrested in .pdf
What does it mean if a human female oocyte is no longer arrested in .pdfWhat does it mean if a human female oocyte is no longer arrested in .pdf
What does it mean if a human female oocyte is no longer arrested in .pdf
neetuarya13
 
What is so important about the cells in the HeLo cell cultureWhat.pdf
What is so important about the cells in the HeLo cell cultureWhat.pdfWhat is so important about the cells in the HeLo cell cultureWhat.pdf
What is so important about the cells in the HeLo cell cultureWhat.pdf
neetuarya13
 

More from neetuarya13 (20)

Find the total cost of making a triangular sail that has a base dime.pdf
Find the total cost of making a triangular sail that has a base dime.pdfFind the total cost of making a triangular sail that has a base dime.pdf
Find the total cost of making a triangular sail that has a base dime.pdf
 
Explain Charge, Current, Volta Power and Energy. Also explain relatio.pdf
Explain Charge, Current, Volta Power and Energy. Also explain relatio.pdfExplain Charge, Current, Volta Power and Energy. Also explain relatio.pdf
Explain Charge, Current, Volta Power and Energy. Also explain relatio.pdf
 
Define Managerial Accounting. Why do managers utilize managerial acc.pdf
Define Managerial Accounting. Why do managers utilize managerial acc.pdfDefine Managerial Accounting. Why do managers utilize managerial acc.pdf
Define Managerial Accounting. Why do managers utilize managerial acc.pdf
 
Describe how a third-generation language (3GL) programming language .pdf
Describe how a third-generation language (3GL) programming language .pdfDescribe how a third-generation language (3GL) programming language .pdf
Describe how a third-generation language (3GL) programming language .pdf
 
Biologists have very specific terminology (thats one of the things.pdf
Biologists have very specific terminology (thats one of the things.pdfBiologists have very specific terminology (thats one of the things.pdf
Biologists have very specific terminology (thats one of the things.pdf
 
Bacteria Characteristics Indole oxidase VP Cell Catalase reaction Sha.pdf
Bacteria Characteristics Indole oxidase VP Cell Catalase reaction Sha.pdfBacteria Characteristics Indole oxidase VP Cell Catalase reaction Sha.pdf
Bacteria Characteristics Indole oxidase VP Cell Catalase reaction Sha.pdf
 
All of the following interactions can help hold the tertiary structur.pdf
All of the following interactions can help hold the tertiary structur.pdfAll of the following interactions can help hold the tertiary structur.pdf
All of the following interactions can help hold the tertiary structur.pdf
 
According to the figure below, which of the following statements reg.pdf
According to the figure below, which of the following statements reg.pdfAccording to the figure below, which of the following statements reg.pdf
According to the figure below, which of the following statements reg.pdf
 
3. A plant breeder crosses an inbred soybean cultivar with herbicide.pdf
3. A plant breeder crosses an inbred soybean cultivar with herbicide.pdf3. A plant breeder crosses an inbred soybean cultivar with herbicide.pdf
3. A plant breeder crosses an inbred soybean cultivar with herbicide.pdf
 
A mirror faces a cliff located some distance away. Mounted on the cli.pdf
A mirror faces a cliff located some distance away. Mounted on the cli.pdfA mirror faces a cliff located some distance away. Mounted on the cli.pdf
A mirror faces a cliff located some distance away. Mounted on the cli.pdf
 
Why is it important to identify Classes early in the Unified Process.pdf
Why is it important to identify Classes early in the Unified Process.pdfWhy is it important to identify Classes early in the Unified Process.pdf
Why is it important to identify Classes early in the Unified Process.pdf
 
A male Drosophila melanogaster has the genotype Aa; Bb; Cc; XDY..pdf
A male Drosophila melanogaster has the genotype Aa; Bb; Cc; XDY..pdfA male Drosophila melanogaster has the genotype Aa; Bb; Cc; XDY..pdf
A male Drosophila melanogaster has the genotype Aa; Bb; Cc; XDY..pdf
 
Which of the following facilitated the endosymbiotic acquisition of .pdf
Which of the following facilitated the endosymbiotic acquisition of .pdfWhich of the following facilitated the endosymbiotic acquisition of .pdf
Which of the following facilitated the endosymbiotic acquisition of .pdf
 
Which of the following is true about replication    The lagging s.pdf
Which of the following is true about replication    The lagging s.pdfWhich of the following is true about replication    The lagging s.pdf
Which of the following is true about replication    The lagging s.pdf
 
Which is a common trait among all land plantsVascular tissues tra.pdf
Which is a common trait among all land plantsVascular tissues tra.pdfWhich is a common trait among all land plantsVascular tissues tra.pdf
Which is a common trait among all land plantsVascular tissues tra.pdf
 
Which of the following is an example of company whose business model .pdf
Which of the following is an example of company whose business model .pdfWhich of the following is an example of company whose business model .pdf
Which of the following is an example of company whose business model .pdf
 
what role(s) played by the Equatorial Segment Protein 1 (ESP1) durin.pdf
what role(s) played by the Equatorial Segment Protein 1 (ESP1) durin.pdfwhat role(s) played by the Equatorial Segment Protein 1 (ESP1) durin.pdf
what role(s) played by the Equatorial Segment Protein 1 (ESP1) durin.pdf
 
What are the similarities and differences between simple linear regr.pdf
What are the similarities and differences between simple linear regr.pdfWhat are the similarities and differences between simple linear regr.pdf
What are the similarities and differences between simple linear regr.pdf
 
What does it mean if a human female oocyte is no longer arrested in .pdf
What does it mean if a human female oocyte is no longer arrested in .pdfWhat does it mean if a human female oocyte is no longer arrested in .pdf
What does it mean if a human female oocyte is no longer arrested in .pdf
 
What is so important about the cells in the HeLo cell cultureWhat.pdf
What is so important about the cells in the HeLo cell cultureWhat.pdfWhat is so important about the cells in the HeLo cell cultureWhat.pdf
What is so important about the cells in the HeLo cell cultureWhat.pdf
 

Recently uploaded

RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 

Recently uploaded (20)

RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 

In any given function in java, what do I need to look for in order t.pdf

  • 1. In any given function in java, what do I need to look for in order to determine its space complexity? thank you Solution You need to identify that is there any type of memory your creating locally in function to process current execution of the function. Type of memory generally can be created in function are: 1. local variables . ex int a, double y, String z etc : Space complexity : O(1) => constant 2. An Array, ArrayList, LinkedList, HashMap etc of size K => Space complexity : O(k) For example: void merge(int arr[], int l, int m, int r) { // Find sizes of two subarrays to be merged int n1 = m - l + 1; int n2 = r - m; /* Create temp arrays */ int L[] = new int [n1]; // WE ARE CREATING EXTRA MEMORY int R[] = new int [n2]; // WE ARE CREATING EXTRA MEMORY /*Copy data to temp arrays*/ for (int i=0; i