SlideShare ist ein Scribd-Unternehmen logo
1 von 1
Downloaden Sie, um offline zu lesen
Consider the two functions below which both compute the value of f(n). The function f1 was
replaced with f2 because integer multiplications () were found to take 4 times longer than integer
additions (+).
int f1(n : integer)
if (n == 1) then return(1)
else return(2 f1(n 1));
int f2(n : integer)
if (n == 1) then return(1)
else return(f2(n 1) + f2(n 1));
i. Give a recurrence relation for f1, which satisfies the number of multiplications (*) executed as
a function of n.
ii. Solve the recurrence relation from Part i.
iii. Give a recurrence relation for f2, which satisfies the number of additions (+) executed as a
function of n.
iv. Solve the recurrence relation from Part iii. v. Both functions compute the same function f.
Was it a good idea to replace f1 with f2?

Weitere ähnliche Inhalte

Mehr von americancolor

Consider the following scenarioIn the last few weeks, residents h.pdf
Consider the following scenarioIn the last few weeks, residents h.pdfConsider the following scenarioIn the last few weeks, residents h.pdf
Consider the following scenarioIn the last few weeks, residents h.pdfamericancolor
 
Consider the following wage regression in which you have data on gen.pdf
Consider the following wage regression in which you have data on gen.pdfConsider the following wage regression in which you have data on gen.pdf
Consider the following wage regression in which you have data on gen.pdfamericancolor
 
core issue in frank by ocbc singapore case studyIn 2010, Jin Kang .pdf
core issue in frank by ocbc singapore case studyIn 2010, Jin Kang .pdfcore issue in frank by ocbc singapore case studyIn 2010, Jin Kang .pdf
core issue in frank by ocbc singapore case studyIn 2010, Jin Kang .pdfamericancolor
 
Coronado Corporation tuvo una utilidad neta de $240 000 y pag� divid.pdf
Coronado Corporation tuvo una utilidad neta de $240 000 y pag� divid.pdfCoronado Corporation tuvo una utilidad neta de $240 000 y pag� divid.pdf
Coronado Corporation tuvo una utilidad neta de $240 000 y pag� divid.pdfamericancolor
 
convert this python code to java script. Make sure it works on Eclip.pdf
convert this python code to java script. Make sure it works on Eclip.pdfconvert this python code to java script. Make sure it works on Eclip.pdf
convert this python code to java script. Make sure it works on Eclip.pdfamericancolor
 
Convert M9 to a regular expression. Consider the following generalis.pdf
Convert M9 to a regular expression. Consider the following generalis.pdfConvert M9 to a regular expression. Consider the following generalis.pdf
Convert M9 to a regular expression. Consider the following generalis.pdfamericancolor
 
Control en Netflix Los gerentes no solo controlan los procesos d.pdf
Control en Netflix Los gerentes no solo controlan los procesos d.pdfControl en Netflix Los gerentes no solo controlan los procesos d.pdf
Control en Netflix Los gerentes no solo controlan los procesos d.pdfamericancolor
 
CONTRATO DE ARRENDAMIENTO COMERCIAL Este Contrato de Arrendamiento C.pdf
CONTRATO DE ARRENDAMIENTO COMERCIAL Este Contrato de Arrendamiento C.pdfCONTRATO DE ARRENDAMIENTO COMERCIAL Este Contrato de Arrendamiento C.pdf
CONTRATO DE ARRENDAMIENTO COMERCIAL Este Contrato de Arrendamiento C.pdfamericancolor
 
Contrast the oral and poster method of presenting research at a conf.pdf
Contrast the oral and poster method of presenting research at a conf.pdfContrast the oral and poster method of presenting research at a conf.pdf
Contrast the oral and poster method of presenting research at a conf.pdfamericancolor
 
Contribution Margin Molly Company sells 40,000 units at $14 per unit.pdf
Contribution Margin Molly Company sells 40,000 units at $14 per unit.pdfContribution Margin Molly Company sells 40,000 units at $14 per unit.pdf
Contribution Margin Molly Company sells 40,000 units at $14 per unit.pdfamericancolor
 
ContextualizeWhat are YOUR learning goals What are the course .pdf
ContextualizeWhat are YOUR learning goals What are the course .pdfContextualizeWhat are YOUR learning goals What are the course .pdf
ContextualizeWhat are YOUR learning goals What are the course .pdfamericancolor
 
Contesta las preguntas del siguiente p�rrafo �Deber�a respons.pdf
Contesta las preguntas del siguiente p�rrafo �Deber�a respons.pdfContesta las preguntas del siguiente p�rrafo �Deber�a respons.pdf
Contesta las preguntas del siguiente p�rrafo �Deber�a respons.pdfamericancolor
 
CONTABILIDAD GERENCIAL - DECLARACIONES VERDADERAS O FALSAS.(SALTE .pdf
CONTABILIDAD GERENCIAL - DECLARACIONES VERDADERAS O FALSAS.(SALTE .pdfCONTABILIDAD GERENCIAL - DECLARACIONES VERDADERAS O FALSAS.(SALTE .pdf
CONTABILIDAD GERENCIAL - DECLARACIONES VERDADERAS O FALSAS.(SALTE .pdfamericancolor
 
Continental Airlines vuela alto con su almac�n de datos en tiempo re.pdf
Continental Airlines vuela alto con su almac�n de datos en tiempo re.pdfContinental Airlines vuela alto con su almac�n de datos en tiempo re.pdf
Continental Airlines vuela alto con su almac�n de datos en tiempo re.pdfamericancolor
 
Consider this scenario. Miguel is an experienced forensic evidence a.pdf
Consider this scenario. Miguel is an experienced forensic evidence a.pdfConsider this scenario. Miguel is an experienced forensic evidence a.pdf
Consider this scenario. Miguel is an experienced forensic evidence a.pdfamericancolor
 
Considere una econom�a donde la industria dominante es la producci�n.pdf
Considere una econom�a donde la industria dominante es la producci�n.pdfConsidere una econom�a donde la industria dominante es la producci�n.pdf
Considere una econom�a donde la industria dominante es la producci�n.pdfamericancolor
 
Considere una econom�a descrita por las siguientes ecuacionesY .pdf
Considere una econom�a descrita por las siguientes ecuacionesY .pdfConsidere una econom�a descrita por las siguientes ecuacionesY .pdf
Considere una econom�a descrita por las siguientes ecuacionesY .pdfamericancolor
 
Considere un pa�s con un producto interno bruto (PIB) nominal de $ 1.pdf
Considere un pa�s con un producto interno bruto (PIB) nominal de $ 1.pdfConsidere un pa�s con un producto interno bruto (PIB) nominal de $ 1.pdf
Considere un pa�s con un producto interno bruto (PIB) nominal de $ 1.pdfamericancolor
 
Considere todo lo que ha aprendido en este curso sobre problemas soc.pdf
Considere todo lo que ha aprendido en este curso sobre problemas soc.pdfConsidere todo lo que ha aprendido en este curso sobre problemas soc.pdf
Considere todo lo que ha aprendido en este curso sobre problemas soc.pdfamericancolor
 
Considere los virus en soluci�n como una suspensi�n. �C�mo esperar�a.pdf
Considere los virus en soluci�n como una suspensi�n. �C�mo esperar�a.pdfConsidere los virus en soluci�n como una suspensi�n. �C�mo esperar�a.pdf
Considere los virus en soluci�n como una suspensi�n. �C�mo esperar�a.pdfamericancolor
 

Mehr von americancolor (20)

Consider the following scenarioIn the last few weeks, residents h.pdf
Consider the following scenarioIn the last few weeks, residents h.pdfConsider the following scenarioIn the last few weeks, residents h.pdf
Consider the following scenarioIn the last few weeks, residents h.pdf
 
Consider the following wage regression in which you have data on gen.pdf
Consider the following wage regression in which you have data on gen.pdfConsider the following wage regression in which you have data on gen.pdf
Consider the following wage regression in which you have data on gen.pdf
 
core issue in frank by ocbc singapore case studyIn 2010, Jin Kang .pdf
core issue in frank by ocbc singapore case studyIn 2010, Jin Kang .pdfcore issue in frank by ocbc singapore case studyIn 2010, Jin Kang .pdf
core issue in frank by ocbc singapore case studyIn 2010, Jin Kang .pdf
 
Coronado Corporation tuvo una utilidad neta de $240 000 y pag� divid.pdf
Coronado Corporation tuvo una utilidad neta de $240 000 y pag� divid.pdfCoronado Corporation tuvo una utilidad neta de $240 000 y pag� divid.pdf
Coronado Corporation tuvo una utilidad neta de $240 000 y pag� divid.pdf
 
convert this python code to java script. Make sure it works on Eclip.pdf
convert this python code to java script. Make sure it works on Eclip.pdfconvert this python code to java script. Make sure it works on Eclip.pdf
convert this python code to java script. Make sure it works on Eclip.pdf
 
Convert M9 to a regular expression. Consider the following generalis.pdf
Convert M9 to a regular expression. Consider the following generalis.pdfConvert M9 to a regular expression. Consider the following generalis.pdf
Convert M9 to a regular expression. Consider the following generalis.pdf
 
Control en Netflix Los gerentes no solo controlan los procesos d.pdf
Control en Netflix Los gerentes no solo controlan los procesos d.pdfControl en Netflix Los gerentes no solo controlan los procesos d.pdf
Control en Netflix Los gerentes no solo controlan los procesos d.pdf
 
CONTRATO DE ARRENDAMIENTO COMERCIAL Este Contrato de Arrendamiento C.pdf
CONTRATO DE ARRENDAMIENTO COMERCIAL Este Contrato de Arrendamiento C.pdfCONTRATO DE ARRENDAMIENTO COMERCIAL Este Contrato de Arrendamiento C.pdf
CONTRATO DE ARRENDAMIENTO COMERCIAL Este Contrato de Arrendamiento C.pdf
 
Contrast the oral and poster method of presenting research at a conf.pdf
Contrast the oral and poster method of presenting research at a conf.pdfContrast the oral and poster method of presenting research at a conf.pdf
Contrast the oral and poster method of presenting research at a conf.pdf
 
Contribution Margin Molly Company sells 40,000 units at $14 per unit.pdf
Contribution Margin Molly Company sells 40,000 units at $14 per unit.pdfContribution Margin Molly Company sells 40,000 units at $14 per unit.pdf
Contribution Margin Molly Company sells 40,000 units at $14 per unit.pdf
 
ContextualizeWhat are YOUR learning goals What are the course .pdf
ContextualizeWhat are YOUR learning goals What are the course .pdfContextualizeWhat are YOUR learning goals What are the course .pdf
ContextualizeWhat are YOUR learning goals What are the course .pdf
 
Contesta las preguntas del siguiente p�rrafo �Deber�a respons.pdf
Contesta las preguntas del siguiente p�rrafo �Deber�a respons.pdfContesta las preguntas del siguiente p�rrafo �Deber�a respons.pdf
Contesta las preguntas del siguiente p�rrafo �Deber�a respons.pdf
 
CONTABILIDAD GERENCIAL - DECLARACIONES VERDADERAS O FALSAS.(SALTE .pdf
CONTABILIDAD GERENCIAL - DECLARACIONES VERDADERAS O FALSAS.(SALTE .pdfCONTABILIDAD GERENCIAL - DECLARACIONES VERDADERAS O FALSAS.(SALTE .pdf
CONTABILIDAD GERENCIAL - DECLARACIONES VERDADERAS O FALSAS.(SALTE .pdf
 
Continental Airlines vuela alto con su almac�n de datos en tiempo re.pdf
Continental Airlines vuela alto con su almac�n de datos en tiempo re.pdfContinental Airlines vuela alto con su almac�n de datos en tiempo re.pdf
Continental Airlines vuela alto con su almac�n de datos en tiempo re.pdf
 
Consider this scenario. Miguel is an experienced forensic evidence a.pdf
Consider this scenario. Miguel is an experienced forensic evidence a.pdfConsider this scenario. Miguel is an experienced forensic evidence a.pdf
Consider this scenario. Miguel is an experienced forensic evidence a.pdf
 
Considere una econom�a donde la industria dominante es la producci�n.pdf
Considere una econom�a donde la industria dominante es la producci�n.pdfConsidere una econom�a donde la industria dominante es la producci�n.pdf
Considere una econom�a donde la industria dominante es la producci�n.pdf
 
Considere una econom�a descrita por las siguientes ecuacionesY .pdf
Considere una econom�a descrita por las siguientes ecuacionesY .pdfConsidere una econom�a descrita por las siguientes ecuacionesY .pdf
Considere una econom�a descrita por las siguientes ecuacionesY .pdf
 
Considere un pa�s con un producto interno bruto (PIB) nominal de $ 1.pdf
Considere un pa�s con un producto interno bruto (PIB) nominal de $ 1.pdfConsidere un pa�s con un producto interno bruto (PIB) nominal de $ 1.pdf
Considere un pa�s con un producto interno bruto (PIB) nominal de $ 1.pdf
 
Considere todo lo que ha aprendido en este curso sobre problemas soc.pdf
Considere todo lo que ha aprendido en este curso sobre problemas soc.pdfConsidere todo lo que ha aprendido en este curso sobre problemas soc.pdf
Considere todo lo que ha aprendido en este curso sobre problemas soc.pdf
 
Considere los virus en soluci�n como una suspensi�n. �C�mo esperar�a.pdf
Considere los virus en soluci�n como una suspensi�n. �C�mo esperar�a.pdfConsidere los virus en soluci�n como una suspensi�n. �C�mo esperar�a.pdf
Considere los virus en soluci�n como una suspensi�n. �C�mo esperar�a.pdf
 

Kürzlich hochgeladen

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
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
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
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
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Kürzlich hochgeladen (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
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.
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
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Ữ Â...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Consider the two functions below which both compute the value of f(n.pdf

  • 1. Consider the two functions below which both compute the value of f(n). The function f1 was replaced with f2 because integer multiplications () were found to take 4 times longer than integer additions (+). int f1(n : integer) if (n == 1) then return(1) else return(2 f1(n 1)); int f2(n : integer) if (n == 1) then return(1) else return(f2(n 1) + f2(n 1)); i. Give a recurrence relation for f1, which satisfies the number of multiplications (*) executed as a function of n. ii. Solve the recurrence relation from Part i. iii. Give a recurrence relation for f2, which satisfies the number of additions (+) executed as a function of n. iv. Solve the recurrence relation from Part iii. v. Both functions compute the same function f. Was it a good idea to replace f1 with f2?