SlideShare une entreprise Scribd logo
1  sur  2
What is the tight big-Oh running time of the following code segment?
a = 1
i = 1
while i < n
a = a * i
i = i + 1
endwhile
j = i
while j > 1
k = 1
while k < m
a = a + k -j
k = k + 1
endwhile
j = j / 2
endwhile
Solution
algorithm total steps:
a = 1 1
i = 1 1
while i < n   n+1
a = a * i n
i = i + 1 n
endwhile
j = i 1
while j > 1 n+1
k = 1 n
while k < m m+1
a = a + k -j mn
k = k + 1 mn
endwhile
j = j / 2 n
endwhile
therefore big oh running time is mn by eliminating all the lower values. we get the runing time
by adding all the above terms and neglecting the small values.

Contenu connexe

Plus de rtodd100

What is the significance of renaming the role of Programming Secretary.docx
What is the significance of renaming the role of Programming Secretary.docxWhat is the significance of renaming the role of Programming Secretary.docx
What is the significance of renaming the role of Programming Secretary.docxrtodd100
 
What is the primary role of internal controls in managing a busines- a.docx
What is the primary role of internal controls in managing a busines- a.docxWhat is the primary role of internal controls in managing a busines- a.docx
What is the primary role of internal controls in managing a busines- a.docxrtodd100
 
What is the pH of a saturated solution of Zn(OH)2 Ksp - 1-1-10-21- Sol.docx
What is the pH of a saturated solution of Zn(OH)2 Ksp - 1-1-10-21- Sol.docxWhat is the pH of a saturated solution of Zn(OH)2 Ksp - 1-1-10-21- Sol.docx
What is the pH of a saturated solution of Zn(OH)2 Ksp - 1-1-10-21- Sol.docxrtodd100
 
What is the pH of the buffer that results when 12-5 g sodium acetate (.docx
What is the pH of the buffer that results when 12-5 g sodium acetate (.docxWhat is the pH of the buffer that results when 12-5 g sodium acetate (.docx
What is the pH of the buffer that results when 12-5 g sodium acetate (.docxrtodd100
 
What is the magnetic field at point Q (20cm to the left of I1- 10cm to.docx
What is the magnetic field at point Q (20cm to the left of I1- 10cm to.docxWhat is the magnetic field at point Q (20cm to the left of I1- 10cm to.docx
What is the magnetic field at point Q (20cm to the left of I1- 10cm to.docxrtodd100
 
What is the final value of x after performing the following operations (1).docx
What is the final value of x after performing the following operations (1).docxWhat is the final value of x after performing the following operations (1).docx
What is the final value of x after performing the following operations (1).docxrtodd100
 
What is the difference between disk partitioning and formatting-Soluti.docx
What is the difference between disk partitioning and formatting-Soluti.docxWhat is the difference between disk partitioning and formatting-Soluti.docx
What is the difference between disk partitioning and formatting-Soluti.docxrtodd100
 
What is the difference in the TLS implementation that allows some expl.docx
What is the difference in the TLS implementation that allows some expl.docxWhat is the difference in the TLS implementation that allows some expl.docx
What is the difference in the TLS implementation that allows some expl.docxrtodd100
 
What is the difference between IS &IT- What is the difference betwee.docx
What is the difference between IS &IT-   What is the difference betwee.docxWhat is the difference between IS &IT-   What is the difference betwee.docx
What is the difference between IS &IT- What is the difference betwee.docxrtodd100
 
What is the difference between interfaced system and integrated system.docx
What is the difference between interfaced system and integrated system.docxWhat is the difference between interfaced system and integrated system.docx
What is the difference between interfaced system and integrated system.docxrtodd100
 
what is the difference between a single beam spectrophotometer and a d.docx
what is the difference between a single beam spectrophotometer and a d.docxwhat is the difference between a single beam spectrophotometer and a d.docx
what is the difference between a single beam spectrophotometer and a d.docxrtodd100
 
What is the difference between the formation of an ionic bond and form.docx
What is the difference between the formation of an ionic bond and form.docxWhat is the difference between the formation of an ionic bond and form.docx
What is the difference between the formation of an ionic bond and form.docxrtodd100
 
What is the difference between a direct and indirect interaction devic.docx
What is the difference between a direct and indirect interaction devic.docxWhat is the difference between a direct and indirect interaction devic.docx
What is the difference between a direct and indirect interaction devic.docxrtodd100
 
what is the difference an organic and inorganic moleculeSolutionCompou.docx
what is the difference an organic and inorganic moleculeSolutionCompou.docxwhat is the difference an organic and inorganic moleculeSolutionCompou.docx
what is the difference an organic and inorganic moleculeSolutionCompou.docxrtodd100
 
What is the conjugate base of H2SO4- What is the conjugate base of H.docx
What is the conjugate base of H2SO4-   What is the conjugate base of H.docxWhat is the conjugate base of H2SO4-   What is the conjugate base of H.docx
What is the conjugate base of H2SO4- What is the conjugate base of H.docxrtodd100
 

Plus de rtodd100 (15)

What is the significance of renaming the role of Programming Secretary.docx
What is the significance of renaming the role of Programming Secretary.docxWhat is the significance of renaming the role of Programming Secretary.docx
What is the significance of renaming the role of Programming Secretary.docx
 
What is the primary role of internal controls in managing a busines- a.docx
What is the primary role of internal controls in managing a busines- a.docxWhat is the primary role of internal controls in managing a busines- a.docx
What is the primary role of internal controls in managing a busines- a.docx
 
What is the pH of a saturated solution of Zn(OH)2 Ksp - 1-1-10-21- Sol.docx
What is the pH of a saturated solution of Zn(OH)2 Ksp - 1-1-10-21- Sol.docxWhat is the pH of a saturated solution of Zn(OH)2 Ksp - 1-1-10-21- Sol.docx
What is the pH of a saturated solution of Zn(OH)2 Ksp - 1-1-10-21- Sol.docx
 
What is the pH of the buffer that results when 12-5 g sodium acetate (.docx
What is the pH of the buffer that results when 12-5 g sodium acetate (.docxWhat is the pH of the buffer that results when 12-5 g sodium acetate (.docx
What is the pH of the buffer that results when 12-5 g sodium acetate (.docx
 
What is the magnetic field at point Q (20cm to the left of I1- 10cm to.docx
What is the magnetic field at point Q (20cm to the left of I1- 10cm to.docxWhat is the magnetic field at point Q (20cm to the left of I1- 10cm to.docx
What is the magnetic field at point Q (20cm to the left of I1- 10cm to.docx
 
What is the final value of x after performing the following operations (1).docx
What is the final value of x after performing the following operations (1).docxWhat is the final value of x after performing the following operations (1).docx
What is the final value of x after performing the following operations (1).docx
 
What is the difference between disk partitioning and formatting-Soluti.docx
What is the difference between disk partitioning and formatting-Soluti.docxWhat is the difference between disk partitioning and formatting-Soluti.docx
What is the difference between disk partitioning and formatting-Soluti.docx
 
What is the difference in the TLS implementation that allows some expl.docx
What is the difference in the TLS implementation that allows some expl.docxWhat is the difference in the TLS implementation that allows some expl.docx
What is the difference in the TLS implementation that allows some expl.docx
 
What is the difference between IS &IT- What is the difference betwee.docx
What is the difference between IS &IT-   What is the difference betwee.docxWhat is the difference between IS &IT-   What is the difference betwee.docx
What is the difference between IS &IT- What is the difference betwee.docx
 
What is the difference between interfaced system and integrated system.docx
What is the difference between interfaced system and integrated system.docxWhat is the difference between interfaced system and integrated system.docx
What is the difference between interfaced system and integrated system.docx
 
what is the difference between a single beam spectrophotometer and a d.docx
what is the difference between a single beam spectrophotometer and a d.docxwhat is the difference between a single beam spectrophotometer and a d.docx
what is the difference between a single beam spectrophotometer and a d.docx
 
What is the difference between the formation of an ionic bond and form.docx
What is the difference between the formation of an ionic bond and form.docxWhat is the difference between the formation of an ionic bond and form.docx
What is the difference between the formation of an ionic bond and form.docx
 
What is the difference between a direct and indirect interaction devic.docx
What is the difference between a direct and indirect interaction devic.docxWhat is the difference between a direct and indirect interaction devic.docx
What is the difference between a direct and indirect interaction devic.docx
 
what is the difference an organic and inorganic moleculeSolutionCompou.docx
what is the difference an organic and inorganic moleculeSolutionCompou.docxwhat is the difference an organic and inorganic moleculeSolutionCompou.docx
what is the difference an organic and inorganic moleculeSolutionCompou.docx
 
What is the conjugate base of H2SO4- What is the conjugate base of H.docx
What is the conjugate base of H2SO4-   What is the conjugate base of H.docxWhat is the conjugate base of H2SO4-   What is the conjugate base of H.docx
What is the conjugate base of H2SO4- What is the conjugate base of H.docx
 

Dernier

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 

Dernier (20)

TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 

What is the tight big-Oh running time of the following code segment- a.docx

  • 1. What is the tight big-Oh running time of the following code segment? a = 1 i = 1 while i < n a = a * i i = i + 1 endwhile j = i while j > 1 k = 1 while k < m a = a + k -j k = k + 1 endwhile j = j / 2 endwhile Solution algorithm total steps:
  • 2. a = 1 1 i = 1 1 while i < n   n+1 a = a * i n i = i + 1 n endwhile j = i 1 while j > 1 n+1 k = 1 n while k < m m+1 a = a + k -j mn k = k + 1 mn endwhile j = j / 2 n endwhile therefore big oh running time is mn by eliminating all the lower values. we get the runing time by adding all the above terms and neglecting the small values.