SlideShare ist ein Scribd-Unternehmen logo
1 von 2
An average programmer implements merge sort, using a high-level language with an inefficient
compiler, with the resulting code taking instructions. One uses computer A which executes 10
billion instructions per second. To sort 10 million numbers, how long does it take for computer A
to complete the task?
Solution
To sort 10 million numbers, computer A takes
2.((10)^7)^2 instructions/(10)^10 instructions/second=20,000 seconds (more than 5.5 hours)
;
while computer B takes
50.(10)^7 lg (10)^7 instructions/(10)^7 instructions/second = 1163 seconds (less than 20
minutes) approx
By using an algorithm whose running time grows more slowly, even with a poor
compiler, computer B runs more than 17 times faster than computer A! The advantage
of merge sort is even more pronounced when we sort 100 million numbers:
where insertion sort takes more than 23 days, merge sort takes under four hours.
In general, as the problem size increases, so does the relative advantage of merge
sort.
this is why efficiency is important in programming
An average programmer implements merge sort- using a high-level langua.docx

Weitere ähnliche Inhalte

Ähnlich wie An average programmer implements merge sort- using a high-level langua.docx

Unified Stream & Batch Processing with Apache Flink (Hadoop Summit Dublin 2016)
Unified Stream & Batch Processing with Apache Flink (Hadoop Summit Dublin 2016)Unified Stream & Batch Processing with Apache Flink (Hadoop Summit Dublin 2016)
Unified Stream & Batch Processing with Apache Flink (Hadoop Summit Dublin 2016)ucelebi
 
LKGtoPG - Basics of C Language
LKGtoPG - Basics of  C LanguageLKGtoPG - Basics of  C Language
LKGtoPG - Basics of C Languagelkgtopg jobs
 
Solving Problems At Scale With Redis
Solving Problems At Scale With RedisSolving Problems At Scale With Redis
Solving Problems At Scale With RedisRedis Labs
 
Paper id 27201431
Paper id 27201431Paper id 27201431
Paper id 27201431IJRAT
 

Ähnlich wie An average programmer implements merge sort- using a high-level langua.docx (6)

Unified Stream & Batch Processing with Apache Flink (Hadoop Summit Dublin 2016)
Unified Stream & Batch Processing with Apache Flink (Hadoop Summit Dublin 2016)Unified Stream & Batch Processing with Apache Flink (Hadoop Summit Dublin 2016)
Unified Stream & Batch Processing with Apache Flink (Hadoop Summit Dublin 2016)
 
LKGtoPG - Basics of C Language
LKGtoPG - Basics of  C LanguageLKGtoPG - Basics of  C Language
LKGtoPG - Basics of C Language
 
Solving Problems At Scale With Redis
Solving Problems At Scale With RedisSolving Problems At Scale With Redis
Solving Problems At Scale With Redis
 
Paper id 27201431
Paper id 27201431Paper id 27201431
Paper id 27201431
 
OO analysis_Lecture12.ppt
OO analysis_Lecture12.pptOO analysis_Lecture12.ppt
OO analysis_Lecture12.ppt
 
Tutorial
TutorialTutorial
Tutorial
 

Mehr von shawnk7

An IP datagram has arrived with the following information in the heade.docx
An IP datagram has arrived with the following information in the heade.docxAn IP datagram has arrived with the following information in the heade.docx
An IP datagram has arrived with the following information in the heade.docxshawnk7
 
An Institutional Review Board (IRB) is concerned with how human partic.docx
An Institutional Review Board (IRB) is concerned with how human partic.docxAn Institutional Review Board (IRB) is concerned with how human partic.docx
An Institutional Review Board (IRB) is concerned with how human partic.docxshawnk7
 
An economy is characterized by the following behavioral equations- C -.docx
An economy is characterized by the following behavioral equations- C -.docxAn economy is characterized by the following behavioral equations- C -.docx
An economy is characterized by the following behavioral equations- C -.docxshawnk7
 
An auditor examines a sample of cancelled checks to verify that the ch.docx
An auditor examines a sample of cancelled checks to verify that the ch.docxAn auditor examines a sample of cancelled checks to verify that the ch.docx
An auditor examines a sample of cancelled checks to verify that the ch.docxshawnk7
 
All of the following are false regarding apportionment except- a Ap.docx
All of the following are false regarding apportionment except-    a Ap.docxAll of the following are false regarding apportionment except-    a Ap.docx
All of the following are false regarding apportionment except- a Ap.docxshawnk7
 
Also indicate all zero-force members- Check all that apply- Check all.docx
Also indicate all zero-force members- Check all that apply- Check all.docxAlso indicate all zero-force members- Check all that apply- Check all.docx
Also indicate all zero-force members- Check all that apply- Check all.docxshawnk7
 
Although objectives- functional tactics- and action items are included.docx
Although objectives- functional tactics- and action items are included.docxAlthough objectives- functional tactics- and action items are included.docx
Although objectives- functional tactics- and action items are included.docxshawnk7
 
prove or disprove that H - {n e(element) Z- n is divisible by both 8.docx
prove or disprove  that H - {n e(element) Z- n is divisible by both 8.docxprove or disprove  that H - {n e(element) Z- n is divisible by both 8.docx
prove or disprove that H - {n e(element) Z- n is divisible by both 8.docxshawnk7
 
Project 3 is based on the materials from Freakonomics Radio Podcast- H.docx
Project 3 is based on the materials from Freakonomics Radio Podcast- H.docxProject 3 is based on the materials from Freakonomics Radio Podcast- H.docx
Project 3 is based on the materials from Freakonomics Radio Podcast- H.docxshawnk7
 
Problem 9-11A Time Value of Money Concept The following situations inv.docx
Problem 9-11A Time Value of Money Concept The following situations inv.docxProblem 9-11A Time Value of Money Concept The following situations inv.docx
Problem 9-11A Time Value of Money Concept The following situations inv.docxshawnk7
 
Problem 5- -9 points- A red laser of wavelength 670 nm is directed thr.docx
Problem 5- -9 points- A red laser of wavelength 670 nm is directed thr.docxProblem 5- -9 points- A red laser of wavelength 670 nm is directed thr.docx
Problem 5- -9 points- A red laser of wavelength 670 nm is directed thr.docxshawnk7
 
Problem 3-32 Internal and Sustainable Growth Rates (LG3-6) Use the fol.docx
Problem 3-32 Internal and Sustainable Growth Rates (LG3-6) Use the fol.docxProblem 3-32 Internal and Sustainable Growth Rates (LG3-6) Use the fol.docx
Problem 3-32 Internal and Sustainable Growth Rates (LG3-6) Use the fol.docxshawnk7
 
Problem 11-6A Problem 11-6A Irwin Corporation has been au.docx
Problem 11-6A             Problem 11-6A  Irwin Corporation has been au.docxProblem 11-6A             Problem 11-6A  Irwin Corporation has been au.docx
Problem 11-6A Problem 11-6A Irwin Corporation has been au.docxshawnk7
 

Mehr von shawnk7 (13)

An IP datagram has arrived with the following information in the heade.docx
An IP datagram has arrived with the following information in the heade.docxAn IP datagram has arrived with the following information in the heade.docx
An IP datagram has arrived with the following information in the heade.docx
 
An Institutional Review Board (IRB) is concerned with how human partic.docx
An Institutional Review Board (IRB) is concerned with how human partic.docxAn Institutional Review Board (IRB) is concerned with how human partic.docx
An Institutional Review Board (IRB) is concerned with how human partic.docx
 
An economy is characterized by the following behavioral equations- C -.docx
An economy is characterized by the following behavioral equations- C -.docxAn economy is characterized by the following behavioral equations- C -.docx
An economy is characterized by the following behavioral equations- C -.docx
 
An auditor examines a sample of cancelled checks to verify that the ch.docx
An auditor examines a sample of cancelled checks to verify that the ch.docxAn auditor examines a sample of cancelled checks to verify that the ch.docx
An auditor examines a sample of cancelled checks to verify that the ch.docx
 
All of the following are false regarding apportionment except- a Ap.docx
All of the following are false regarding apportionment except-    a Ap.docxAll of the following are false regarding apportionment except-    a Ap.docx
All of the following are false regarding apportionment except- a Ap.docx
 
Also indicate all zero-force members- Check all that apply- Check all.docx
Also indicate all zero-force members- Check all that apply- Check all.docxAlso indicate all zero-force members- Check all that apply- Check all.docx
Also indicate all zero-force members- Check all that apply- Check all.docx
 
Although objectives- functional tactics- and action items are included.docx
Although objectives- functional tactics- and action items are included.docxAlthough objectives- functional tactics- and action items are included.docx
Although objectives- functional tactics- and action items are included.docx
 
prove or disprove that H - {n e(element) Z- n is divisible by both 8.docx
prove or disprove  that H - {n e(element) Z- n is divisible by both 8.docxprove or disprove  that H - {n e(element) Z- n is divisible by both 8.docx
prove or disprove that H - {n e(element) Z- n is divisible by both 8.docx
 
Project 3 is based on the materials from Freakonomics Radio Podcast- H.docx
Project 3 is based on the materials from Freakonomics Radio Podcast- H.docxProject 3 is based on the materials from Freakonomics Radio Podcast- H.docx
Project 3 is based on the materials from Freakonomics Radio Podcast- H.docx
 
Problem 9-11A Time Value of Money Concept The following situations inv.docx
Problem 9-11A Time Value of Money Concept The following situations inv.docxProblem 9-11A Time Value of Money Concept The following situations inv.docx
Problem 9-11A Time Value of Money Concept The following situations inv.docx
 
Problem 5- -9 points- A red laser of wavelength 670 nm is directed thr.docx
Problem 5- -9 points- A red laser of wavelength 670 nm is directed thr.docxProblem 5- -9 points- A red laser of wavelength 670 nm is directed thr.docx
Problem 5- -9 points- A red laser of wavelength 670 nm is directed thr.docx
 
Problem 3-32 Internal and Sustainable Growth Rates (LG3-6) Use the fol.docx
Problem 3-32 Internal and Sustainable Growth Rates (LG3-6) Use the fol.docxProblem 3-32 Internal and Sustainable Growth Rates (LG3-6) Use the fol.docx
Problem 3-32 Internal and Sustainable Growth Rates (LG3-6) Use the fol.docx
 
Problem 11-6A Problem 11-6A Irwin Corporation has been au.docx
Problem 11-6A             Problem 11-6A  Irwin Corporation has been au.docxProblem 11-6A             Problem 11-6A  Irwin Corporation has been au.docx
Problem 11-6A Problem 11-6A Irwin Corporation has been au.docx
 

Kürzlich hochgeladen

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 

Kürzlich hochgeladen (20)

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 

An average programmer implements merge sort- using a high-level langua.docx

  • 1. An average programmer implements merge sort, using a high-level language with an inefficient compiler, with the resulting code taking instructions. One uses computer A which executes 10 billion instructions per second. To sort 10 million numbers, how long does it take for computer A to complete the task? Solution To sort 10 million numbers, computer A takes 2.((10)^7)^2 instructions/(10)^10 instructions/second=20,000 seconds (more than 5.5 hours) ; while computer B takes 50.(10)^7 lg (10)^7 instructions/(10)^7 instructions/second = 1163 seconds (less than 20 minutes) approx By using an algorithm whose running time grows more slowly, even with a poor compiler, computer B runs more than 17 times faster than computer A! The advantage of merge sort is even more pronounced when we sort 100 million numbers: where insertion sort takes more than 23 days, merge sort takes under four hours. In general, as the problem size increases, so does the relative advantage of merge sort. this is why efficiency is important in programming