SlideShare a Scribd company logo
1. What is the time complexity in Big-O for the following two Java code snippets?
a): Snippet one:
int i = 1;
while(i <= n){
System.out.println("i = : " + i);
i *= 2;
}
b): Snippet two:
int i = 1, j = 1;
while(i <= n){
while(j <= n){
System.out.println("i: " + i + " and j: " + j);
j *= 2;
}
i++;
}

More Related Content

More from afgt2012

1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf
afgt2012
 
1- The Fayette County Health Department was notified that Amy Cress- a.pdf
1- The Fayette County Health Department was notified that Amy Cress- a.pdf1- The Fayette County Health Department was notified that Amy Cress- a.pdf
1- The Fayette County Health Department was notified that Amy Cress- a.pdf
afgt2012
 
1- The first exercise is to find the various partials of CE(S-t) in or.pdf
1- The first exercise is to find the various partials of CE(S-t) in or.pdf1- The first exercise is to find the various partials of CE(S-t) in or.pdf
1- The first exercise is to find the various partials of CE(S-t) in or.pdf
afgt2012
 
1- Which of the following changes are NOT evidence of migrating magma-.pdf
1- Which of the following changes are NOT evidence of migrating magma-.pdf1- Which of the following changes are NOT evidence of migrating magma-.pdf
1- Which of the following changes are NOT evidence of migrating magma-.pdf
afgt2012
 
1- Which of the following describes what businesses should do at the t.pdf
1- Which of the following describes what businesses should do at the t.pdf1- Which of the following describes what businesses should do at the t.pdf
1- Which of the following describes what businesses should do at the t.pdf
afgt2012
 
1- Which item below is NOT an example of scientific evidence- Group of.pdf
1- Which item below is NOT an example of scientific evidence- Group of.pdf1- Which item below is NOT an example of scientific evidence- Group of.pdf
1- Which item below is NOT an example of scientific evidence- Group of.pdf
afgt2012
 
1- Where does the energy come from to pump H+ ions across the inner mi.pdf
1- Where does the energy come from to pump H+ ions across the inner mi.pdf1- Where does the energy come from to pump H+ ions across the inner mi.pdf
1- Where does the energy come from to pump H+ ions across the inner mi.pdf
afgt2012
 
1- When you enter dates in the Criteria row- Access places _______ sym.pdf
1- When you enter dates in the Criteria row- Access places _______ sym.pdf1- When you enter dates in the Criteria row- Access places _______ sym.pdf
1- When you enter dates in the Criteria row- Access places _______ sym.pdf
afgt2012
 
1- Which factor do Heckscher-Ohlin identify as the basic determinants.pdf
1- Which factor do Heckscher-Ohlin identify as the basic determinants.pdf1- Which factor do Heckscher-Ohlin identify as the basic determinants.pdf
1- Which factor do Heckscher-Ohlin identify as the basic determinants.pdf
afgt2012
 
1- When a researcher ensures that they are reducing the possiblily of.pdf
1- When a researcher ensures that they are reducing the possiblily of.pdf1- When a researcher ensures that they are reducing the possiblily of.pdf
1- When a researcher ensures that they are reducing the possiblily of.pdf
afgt2012
 
1- What were your intial reactions to the film- 2- Did you learn anyth.pdf
1- What were your intial reactions to the film- 2- Did you learn anyth.pdf1- What were your intial reactions to the film- 2- Did you learn anyth.pdf
1- What were your intial reactions to the film- 2- Did you learn anyth.pdf
afgt2012
 
1- What types of utilities are in operation in the US-- a- Privately-o.pdf
1- What types of utilities are in operation in the US-- a- Privately-o.pdf1- What types of utilities are in operation in the US-- a- Privately-o.pdf
1- What types of utilities are in operation in the US-- a- Privately-o.pdf
afgt2012
 
1- When adding a title to the header of your form or report- Access wi.pdf
1- When adding a title to the header of your form or report- Access wi.pdf1- When adding a title to the header of your form or report- Access wi.pdf
1- When adding a title to the header of your form or report- Access wi.pdf
afgt2012
 
1- What technologies are being used to conduct surveillance- 2- How no.pdf
1- What technologies are being used to conduct surveillance- 2- How no.pdf1- What technologies are being used to conduct surveillance- 2- How no.pdf
1- What technologies are being used to conduct surveillance- 2- How no.pdf
afgt2012
 
1- What pattern exist between the amount of weathering and the compass.pdf
1- What pattern exist between the amount of weathering and the compass.pdf1- What pattern exist between the amount of weathering and the compass.pdf
1- What pattern exist between the amount of weathering and the compass.pdf
afgt2012
 
1- what is the test statistic 2- What is the p-value Note the hilighte.pdf
1- what is the test statistic 2- What is the p-value Note the hilighte.pdf1- what is the test statistic 2- What is the p-value Note the hilighte.pdf
1- what is the test statistic 2- What is the p-value Note the hilighte.pdf
afgt2012
 
1- what is the result of B- cerus in the endospore stain-2- what is th.pdf
1- what is the result of B- cerus in the endospore stain-2- what is th.pdf1- what is the result of B- cerus in the endospore stain-2- what is th.pdf
1- what is the result of B- cerus in the endospore stain-2- what is th.pdf
afgt2012
 
1- what is the result of P- Vulgaris in the Negative Stain- 2-What is.pdf
1- what is the result of P- Vulgaris in the Negative Stain- 2-What is.pdf1- what is the result of P- Vulgaris in the Negative Stain- 2-What is.pdf
1- what is the result of P- Vulgaris in the Negative Stain- 2-What is.pdf
afgt2012
 
1- What is the probability in the offsprings if the parents are colorb.pdf
1- What is the probability in the offsprings if the parents are colorb.pdf1- What is the probability in the offsprings if the parents are colorb.pdf
1- What is the probability in the offsprings if the parents are colorb.pdf
afgt2012
 
1- What kind of population growth pattern exhibits initial rapid growt.pdf
1- What kind of population growth pattern exhibits initial rapid growt.pdf1- What kind of population growth pattern exhibits initial rapid growt.pdf
1- What kind of population growth pattern exhibits initial rapid growt.pdf
afgt2012
 

More from afgt2012 (20)

1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf1- The design of a singly-linked list below is a picture of the functi (1).pdf
1- The design of a singly-linked list below is a picture of the functi (1).pdf
 
1- The Fayette County Health Department was notified that Amy Cress- a.pdf
1- The Fayette County Health Department was notified that Amy Cress- a.pdf1- The Fayette County Health Department was notified that Amy Cress- a.pdf
1- The Fayette County Health Department was notified that Amy Cress- a.pdf
 
1- The first exercise is to find the various partials of CE(S-t) in or.pdf
1- The first exercise is to find the various partials of CE(S-t) in or.pdf1- The first exercise is to find the various partials of CE(S-t) in or.pdf
1- The first exercise is to find the various partials of CE(S-t) in or.pdf
 
1- Which of the following changes are NOT evidence of migrating magma-.pdf
1- Which of the following changes are NOT evidence of migrating magma-.pdf1- Which of the following changes are NOT evidence of migrating magma-.pdf
1- Which of the following changes are NOT evidence of migrating magma-.pdf
 
1- Which of the following describes what businesses should do at the t.pdf
1- Which of the following describes what businesses should do at the t.pdf1- Which of the following describes what businesses should do at the t.pdf
1- Which of the following describes what businesses should do at the t.pdf
 
1- Which item below is NOT an example of scientific evidence- Group of.pdf
1- Which item below is NOT an example of scientific evidence- Group of.pdf1- Which item below is NOT an example of scientific evidence- Group of.pdf
1- Which item below is NOT an example of scientific evidence- Group of.pdf
 
1- Where does the energy come from to pump H+ ions across the inner mi.pdf
1- Where does the energy come from to pump H+ ions across the inner mi.pdf1- Where does the energy come from to pump H+ ions across the inner mi.pdf
1- Where does the energy come from to pump H+ ions across the inner mi.pdf
 
1- When you enter dates in the Criteria row- Access places _______ sym.pdf
1- When you enter dates in the Criteria row- Access places _______ sym.pdf1- When you enter dates in the Criteria row- Access places _______ sym.pdf
1- When you enter dates in the Criteria row- Access places _______ sym.pdf
 
1- Which factor do Heckscher-Ohlin identify as the basic determinants.pdf
1- Which factor do Heckscher-Ohlin identify as the basic determinants.pdf1- Which factor do Heckscher-Ohlin identify as the basic determinants.pdf
1- Which factor do Heckscher-Ohlin identify as the basic determinants.pdf
 
1- When a researcher ensures that they are reducing the possiblily of.pdf
1- When a researcher ensures that they are reducing the possiblily of.pdf1- When a researcher ensures that they are reducing the possiblily of.pdf
1- When a researcher ensures that they are reducing the possiblily of.pdf
 
1- What were your intial reactions to the film- 2- Did you learn anyth.pdf
1- What were your intial reactions to the film- 2- Did you learn anyth.pdf1- What were your intial reactions to the film- 2- Did you learn anyth.pdf
1- What were your intial reactions to the film- 2- Did you learn anyth.pdf
 
1- What types of utilities are in operation in the US-- a- Privately-o.pdf
1- What types of utilities are in operation in the US-- a- Privately-o.pdf1- What types of utilities are in operation in the US-- a- Privately-o.pdf
1- What types of utilities are in operation in the US-- a- Privately-o.pdf
 
1- When adding a title to the header of your form or report- Access wi.pdf
1- When adding a title to the header of your form or report- Access wi.pdf1- When adding a title to the header of your form or report- Access wi.pdf
1- When adding a title to the header of your form or report- Access wi.pdf
 
1- What technologies are being used to conduct surveillance- 2- How no.pdf
1- What technologies are being used to conduct surveillance- 2- How no.pdf1- What technologies are being used to conduct surveillance- 2- How no.pdf
1- What technologies are being used to conduct surveillance- 2- How no.pdf
 
1- What pattern exist between the amount of weathering and the compass.pdf
1- What pattern exist between the amount of weathering and the compass.pdf1- What pattern exist between the amount of weathering and the compass.pdf
1- What pattern exist between the amount of weathering and the compass.pdf
 
1- what is the test statistic 2- What is the p-value Note the hilighte.pdf
1- what is the test statistic 2- What is the p-value Note the hilighte.pdf1- what is the test statistic 2- What is the p-value Note the hilighte.pdf
1- what is the test statistic 2- What is the p-value Note the hilighte.pdf
 
1- what is the result of B- cerus in the endospore stain-2- what is th.pdf
1- what is the result of B- cerus in the endospore stain-2- what is th.pdf1- what is the result of B- cerus in the endospore stain-2- what is th.pdf
1- what is the result of B- cerus in the endospore stain-2- what is th.pdf
 
1- what is the result of P- Vulgaris in the Negative Stain- 2-What is.pdf
1- what is the result of P- Vulgaris in the Negative Stain- 2-What is.pdf1- what is the result of P- Vulgaris in the Negative Stain- 2-What is.pdf
1- what is the result of P- Vulgaris in the Negative Stain- 2-What is.pdf
 
1- What is the probability in the offsprings if the parents are colorb.pdf
1- What is the probability in the offsprings if the parents are colorb.pdf1- What is the probability in the offsprings if the parents are colorb.pdf
1- What is the probability in the offsprings if the parents are colorb.pdf
 
1- What kind of population growth pattern exhibits initial rapid growt.pdf
1- What kind of population growth pattern exhibits initial rapid growt.pdf1- What kind of population growth pattern exhibits initial rapid growt.pdf
1- What kind of population growth pattern exhibits initial rapid growt.pdf
 

Recently uploaded

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
Wasim Ak
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 

Recently uploaded (20)

Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Normal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of LabourNormal Labour/ Stages of Labour/ Mechanism of Labour
Normal Labour/ Stages of Labour/ Mechanism of Labour
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 

1- What is the time complexity in Big-O for the following two Java cod.pdf

  • 1. 1. What is the time complexity in Big-O for the following two Java code snippets? a): Snippet one: int i = 1; while(i <= n){ System.out.println("i = : " + i); i *= 2; } b): Snippet two: int i = 1, j = 1; while(i <= n){ while(j <= n){ System.out.println("i: " + i + " and j: " + j); j *= 2; } i++; }