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

PDF
1- The book discusses cues that we should be aware of when someone beg.pdf
PDF
1- The principle basis for the classification of organisms into the Ki.pdf
PDF
1- The diagram below shows some features of the Earth's crust and uppe.pdf
PDF
1- tell me the enzyme mechanism-biosynthetic pathway 2- tell me what i.pdf
PDF
1- The image below shows a pure phospholipid bilayer- plus water on ei.pdf
PDF
1- Suppose that the economy is in a recession- Show graphically how Ke.pdf
PDF
1- The history of economic growth The following two graphs show GDP pe.pdf
PDF
1- The hormone is released from the hypothalamus that causes the rele.pdf
1- The book discusses cues that we should be aware of when someone beg.pdf
1- The principle basis for the classification of organisms into the Ki.pdf
1- The diagram below shows some features of the Earth's crust and uppe.pdf
1- tell me the enzyme mechanism-biosynthetic pathway 2- tell me what i.pdf
1- The image below shows a pure phospholipid bilayer- plus water on ei.pdf
1- Suppose that the economy is in a recession- Show graphically how Ke.pdf
1- The history of economic growth The following two graphs show GDP pe.pdf
1- The hormone is released from the hypothalamus that causes the rele.pdf

More from afgt2012 (20)

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

Recently uploaded (20)

PDF
English Textual Question & Ans (12th Class).pdf
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PDF
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
PDF
semiconductor packaging in vlsi design fab
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
DOCX
Cambridge-Practice-Tests-for-IELTS-12.docx
PDF
Mucosal Drug Delivery system_NDDS_BPHARMACY__SEM VII_PCI.pdf
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PPTX
What’s under the hood: Parsing standardized learning content for AI
PDF
HVAC Specification 2024 according to central public works department
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
Journal of Dental Science - UDMY (2021).pdf
PPTX
Computer Architecture Input Output Memory.pptx
PDF
International_Financial_Reporting_Standa.pdf
PPTX
Education and Perspectives of Education.pptx
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
English Textual Question & Ans (12th Class).pdf
Paper A Mock Exam 9_ Attempt review.pdf.
LIFE & LIVING TRILOGY- PART (1) WHO ARE WE.pdf
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
semiconductor packaging in vlsi design fab
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
LEARNERS WITH ADDITIONAL NEEDS ProfEd Topic
Cambridge-Practice-Tests-for-IELTS-12.docx
Mucosal Drug Delivery system_NDDS_BPHARMACY__SEM VII_PCI.pdf
Core Concepts of Personalized Learning and Virtual Learning Environments
B.Sc. DS Unit 2 Software Engineering.pptx
What’s under the hood: Parsing standardized learning content for AI
HVAC Specification 2024 according to central public works department
Unit 4 Computer Architecture Multicore Processor.pptx
Journal of Dental Science - UDMY (2021).pdf
Computer Architecture Input Output Memory.pptx
International_Financial_Reporting_Standa.pdf
Education and Perspectives of Education.pptx
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
Ad

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++; }