SlideShare a Scribd company logo
1 of 1
Download to read offline
We consider the following problem: Suppose that you are given a 0/1 string S of kind 1m0n, that
is, it has m01 's at the beginning, followed by n00 's. Note that m and n are unknown to the
algorithm, only k=m+n is known. Also note, that either m or n can be equal to zero, but not both.
(a) [14 marks] Design a divide-and-conquer algorithm that finds the number of zeroes in S in time
O(logk), where k=m+n. Assume that the input string S is given in an array S[1,,k]. Give a brief
argument showing that your algorithm is correct. (b) [12 marks] Give an argument that your
algorithm indeed has O(logk) running time, by formulating, explaining and solving an appropriate
recurrence equation. Assume that each comparison or arithmetic operation takes constant time.

More Related Content

More from DARSHANACHARYA13

VvS L MInICases Chapter 4 Small Business Processes and S.pdf
VvS L MInICases Chapter 4  Small Business Processes and S.pdfVvS L MInICases Chapter 4  Small Business Processes and S.pdf
VvS L MInICases Chapter 4 Small Business Processes and S.pdfDARSHANACHARYA13
 
W3 Cumulative Project Assignment Data Types 1 Create at le.pdf
W3 Cumulative Project Assignment Data Types 1 Create at le.pdfW3 Cumulative Project Assignment Data Types 1 Create at le.pdf
W3 Cumulative Project Assignment Data Types 1 Create at le.pdfDARSHANACHARYA13
 
Vulcan Flyovers offers scenic overfights of Mount Saint Hele.pdf
Vulcan Flyovers offers scenic overfights of Mount Saint Hele.pdfVulcan Flyovers offers scenic overfights of Mount Saint Hele.pdf
Vulcan Flyovers offers scenic overfights of Mount Saint Hele.pdfDARSHANACHARYA13
 
Vertic Analysis Bal Sheet Ratios gtO Herrera Inc O H.pdf
Vertic Analysis Bal Sheet Ratios gtO Herrera Inc O H.pdfVertic Analysis Bal Sheet Ratios gtO Herrera Inc O H.pdf
Vertic Analysis Bal Sheet Ratios gtO Herrera Inc O H.pdfDARSHANACHARYA13
 
Vito Brassimo ev ses sistemlerinde uzmanlam bir talyan irke.pdf
Vito Brassimo ev ses sistemlerinde uzmanlam bir talyan irke.pdfVito Brassimo ev ses sistemlerinde uzmanlam bir talyan irke.pdf
Vito Brassimo ev ses sistemlerinde uzmanlam bir talyan irke.pdfDARSHANACHARYA13
 
W them and Interference NOTE The mutant versions of these.pdf
W them and Interference NOTE The mutant versions of these.pdfW them and Interference NOTE The mutant versions of these.pdf
W them and Interference NOTE The mutant versions of these.pdfDARSHANACHARYA13
 
Vulcan Flyovers offers scenic overflights of Mount Saint Hel.pdf
Vulcan Flyovers offers scenic overflights of Mount Saint Hel.pdfVulcan Flyovers offers scenic overflights of Mount Saint Hel.pdf
Vulcan Flyovers offers scenic overflights of Mount Saint Hel.pdfDARSHANACHARYA13
 
Vincentys formulas are two related iterative methods used .pdf
Vincentys formulas are two related iterative methods used .pdfVincentys formulas are two related iterative methods used .pdf
Vincentys formulas are two related iterative methods used .pdfDARSHANACHARYA13
 
Volunteered geographic information is supplied to the commun.pdf
Volunteered geographic information is supplied to the commun.pdfVolunteered geographic information is supplied to the commun.pdf
Volunteered geographic information is supplied to the commun.pdfDARSHANACHARYA13
 
Visita de Wendy Shay a Kufuor Sammy Awuku descontento con l.pdf
Visita de Wendy Shay a Kufuor Sammy Awuku descontento con l.pdfVisita de Wendy Shay a Kufuor Sammy Awuku descontento con l.pdf
Visita de Wendy Shay a Kufuor Sammy Awuku descontento con l.pdfDARSHANACHARYA13
 
Veri kmesindeki her yantlayan iin birden fazla gzlem rapo.pdf
Veri kmesindeki her yantlayan iin birden fazla gzlem rapo.pdfVeri kmesindeki her yantlayan iin birden fazla gzlem rapo.pdf
Veri kmesindeki her yantlayan iin birden fazla gzlem rapo.pdfDARSHANACHARYA13
 
Veriler bireysel satlar anlamak iin yararldr ancak bir i .pdf
Veriler bireysel satlar anlamak iin yararldr ancak bir i .pdfVeriler bireysel satlar anlamak iin yararldr ancak bir i .pdf
Veriler bireysel satlar anlamak iin yararldr ancak bir i .pdfDARSHANACHARYA13
 
Village Laundry reported assets of 900 and equity of 520 .pdf
Village Laundry reported assets of 900 and equity of 520 .pdfVillage Laundry reported assets of 900 and equity of 520 .pdf
Village Laundry reported assets of 900 and equity of 520 .pdfDARSHANACHARYA13
 
Vidicn the neuron with its correct description Use the drop.pdf
Vidicn the neuron with its correct description Use the drop.pdfVidicn the neuron with its correct description Use the drop.pdf
Vidicn the neuron with its correct description Use the drop.pdfDARSHANACHARYA13
 
Video oyunlarnn demografisi deiiyor kadnlar rksal ve etnik.pdf
Video oyunlarnn demografisi deiiyor kadnlar rksal ve etnik.pdfVideo oyunlarnn demografisi deiiyor kadnlar rksal ve etnik.pdf
Video oyunlarnn demografisi deiiyor kadnlar rksal ve etnik.pdfDARSHANACHARYA13
 
Verdadero o falso Los dividendos pagados a accionistas corp.pdf
Verdadero o falso  Los dividendos pagados a accionistas corp.pdfVerdadero o falso  Los dividendos pagados a accionistas corp.pdf
Verdadero o falso Los dividendos pagados a accionistas corp.pdfDARSHANACHARYA13
 
Varsayalm ki tm Trk aile poplasyonu aile bykl iin aa.pdf
Varsayalm ki tm Trk aile poplasyonu aile bykl iin aa.pdfVarsayalm ki tm Trk aile poplasyonu aile bykl iin aa.pdf
Varsayalm ki tm Trk aile poplasyonu aile bykl iin aa.pdfDARSHANACHARYA13
 
Variations too much or too little in healthcare indicate p.pdf
Variations too much or too little in healthcare indicate p.pdfVariations too much or too little in healthcare indicate p.pdf
Variations too much or too little in healthcare indicate p.pdfDARSHANACHARYA13
 
VERDADERO FALSO 1 A medida que el agua se acumula en la re.pdf
VERDADERO FALSO  1 A medida que el agua se acumula en la re.pdfVERDADERO FALSO  1 A medida que el agua se acumula en la re.pdf
VERDADERO FALSO 1 A medida que el agua se acumula en la re.pdfDARSHANACHARYA13
 
VAKA Nihai Ofis rnleri Deiime ve Yenilie nc Ultim.pdf
VAKA Nihai Ofis rnleri Deiime ve Yenilie nc     Ultim.pdfVAKA Nihai Ofis rnleri Deiime ve Yenilie nc     Ultim.pdf
VAKA Nihai Ofis rnleri Deiime ve Yenilie nc Ultim.pdfDARSHANACHARYA13
 

More from DARSHANACHARYA13 (20)

VvS L MInICases Chapter 4 Small Business Processes and S.pdf
VvS L MInICases Chapter 4  Small Business Processes and S.pdfVvS L MInICases Chapter 4  Small Business Processes and S.pdf
VvS L MInICases Chapter 4 Small Business Processes and S.pdf
 
W3 Cumulative Project Assignment Data Types 1 Create at le.pdf
W3 Cumulative Project Assignment Data Types 1 Create at le.pdfW3 Cumulative Project Assignment Data Types 1 Create at le.pdf
W3 Cumulative Project Assignment Data Types 1 Create at le.pdf
 
Vulcan Flyovers offers scenic overfights of Mount Saint Hele.pdf
Vulcan Flyovers offers scenic overfights of Mount Saint Hele.pdfVulcan Flyovers offers scenic overfights of Mount Saint Hele.pdf
Vulcan Flyovers offers scenic overfights of Mount Saint Hele.pdf
 
Vertic Analysis Bal Sheet Ratios gtO Herrera Inc O H.pdf
Vertic Analysis Bal Sheet Ratios gtO Herrera Inc O H.pdfVertic Analysis Bal Sheet Ratios gtO Herrera Inc O H.pdf
Vertic Analysis Bal Sheet Ratios gtO Herrera Inc O H.pdf
 
Vito Brassimo ev ses sistemlerinde uzmanlam bir talyan irke.pdf
Vito Brassimo ev ses sistemlerinde uzmanlam bir talyan irke.pdfVito Brassimo ev ses sistemlerinde uzmanlam bir talyan irke.pdf
Vito Brassimo ev ses sistemlerinde uzmanlam bir talyan irke.pdf
 
W them and Interference NOTE The mutant versions of these.pdf
W them and Interference NOTE The mutant versions of these.pdfW them and Interference NOTE The mutant versions of these.pdf
W them and Interference NOTE The mutant versions of these.pdf
 
Vulcan Flyovers offers scenic overflights of Mount Saint Hel.pdf
Vulcan Flyovers offers scenic overflights of Mount Saint Hel.pdfVulcan Flyovers offers scenic overflights of Mount Saint Hel.pdf
Vulcan Flyovers offers scenic overflights of Mount Saint Hel.pdf
 
Vincentys formulas are two related iterative methods used .pdf
Vincentys formulas are two related iterative methods used .pdfVincentys formulas are two related iterative methods used .pdf
Vincentys formulas are two related iterative methods used .pdf
 
Volunteered geographic information is supplied to the commun.pdf
Volunteered geographic information is supplied to the commun.pdfVolunteered geographic information is supplied to the commun.pdf
Volunteered geographic information is supplied to the commun.pdf
 
Visita de Wendy Shay a Kufuor Sammy Awuku descontento con l.pdf
Visita de Wendy Shay a Kufuor Sammy Awuku descontento con l.pdfVisita de Wendy Shay a Kufuor Sammy Awuku descontento con l.pdf
Visita de Wendy Shay a Kufuor Sammy Awuku descontento con l.pdf
 
Veri kmesindeki her yantlayan iin birden fazla gzlem rapo.pdf
Veri kmesindeki her yantlayan iin birden fazla gzlem rapo.pdfVeri kmesindeki her yantlayan iin birden fazla gzlem rapo.pdf
Veri kmesindeki her yantlayan iin birden fazla gzlem rapo.pdf
 
Veriler bireysel satlar anlamak iin yararldr ancak bir i .pdf
Veriler bireysel satlar anlamak iin yararldr ancak bir i .pdfVeriler bireysel satlar anlamak iin yararldr ancak bir i .pdf
Veriler bireysel satlar anlamak iin yararldr ancak bir i .pdf
 
Village Laundry reported assets of 900 and equity of 520 .pdf
Village Laundry reported assets of 900 and equity of 520 .pdfVillage Laundry reported assets of 900 and equity of 520 .pdf
Village Laundry reported assets of 900 and equity of 520 .pdf
 
Vidicn the neuron with its correct description Use the drop.pdf
Vidicn the neuron with its correct description Use the drop.pdfVidicn the neuron with its correct description Use the drop.pdf
Vidicn the neuron with its correct description Use the drop.pdf
 
Video oyunlarnn demografisi deiiyor kadnlar rksal ve etnik.pdf
Video oyunlarnn demografisi deiiyor kadnlar rksal ve etnik.pdfVideo oyunlarnn demografisi deiiyor kadnlar rksal ve etnik.pdf
Video oyunlarnn demografisi deiiyor kadnlar rksal ve etnik.pdf
 
Verdadero o falso Los dividendos pagados a accionistas corp.pdf
Verdadero o falso  Los dividendos pagados a accionistas corp.pdfVerdadero o falso  Los dividendos pagados a accionistas corp.pdf
Verdadero o falso Los dividendos pagados a accionistas corp.pdf
 
Varsayalm ki tm Trk aile poplasyonu aile bykl iin aa.pdf
Varsayalm ki tm Trk aile poplasyonu aile bykl iin aa.pdfVarsayalm ki tm Trk aile poplasyonu aile bykl iin aa.pdf
Varsayalm ki tm Trk aile poplasyonu aile bykl iin aa.pdf
 
Variations too much or too little in healthcare indicate p.pdf
Variations too much or too little in healthcare indicate p.pdfVariations too much or too little in healthcare indicate p.pdf
Variations too much or too little in healthcare indicate p.pdf
 
VERDADERO FALSO 1 A medida que el agua se acumula en la re.pdf
VERDADERO FALSO  1 A medida que el agua se acumula en la re.pdfVERDADERO FALSO  1 A medida que el agua se acumula en la re.pdf
VERDADERO FALSO 1 A medida que el agua se acumula en la re.pdf
 
VAKA Nihai Ofis rnleri Deiime ve Yenilie nc Ultim.pdf
VAKA Nihai Ofis rnleri Deiime ve Yenilie nc     Ultim.pdfVAKA Nihai Ofis rnleri Deiime ve Yenilie nc     Ultim.pdf
VAKA Nihai Ofis rnleri Deiime ve Yenilie nc Ultim.pdf
 

Recently uploaded

AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
PUBLIC FINANCE AND TAXATION COURSE-1-4.pdf
PUBLIC FINANCE AND TAXATION COURSE-1-4.pdfPUBLIC FINANCE AND TAXATION COURSE-1-4.pdf
PUBLIC FINANCE AND TAXATION COURSE-1-4.pdfMinawBelay
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfJerry Chew
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMELOISARIVERA8
 
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
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfcupulin
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningMarc Dusseiller Dusjagr
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 

Recently uploaded (20)

AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
PUBLIC FINANCE AND TAXATION COURSE-1-4.pdf
PUBLIC FINANCE AND TAXATION COURSE-1-4.pdfPUBLIC FINANCE AND TAXATION COURSE-1-4.pdf
PUBLIC FINANCE AND TAXATION COURSE-1-4.pdf
 
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdfRich Dad Poor Dad ( PDFDrive.com )--.pdf
Rich Dad Poor Dad ( PDFDrive.com )--.pdf
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
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Ă...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdfContoh Aksi Nyata Refleksi Diri ( NUR ).pdf
Contoh Aksi Nyata Refleksi Diri ( NUR ).pdf
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 

We consider the following problem Suppose that you are give.pdf

  • 1. We consider the following problem: Suppose that you are given a 0/1 string S of kind 1m0n, that is, it has m01 's at the beginning, followed by n00 's. Note that m and n are unknown to the algorithm, only k=m+n is known. Also note, that either m or n can be equal to zero, but not both. (a) [14 marks] Design a divide-and-conquer algorithm that finds the number of zeroes in S in time O(logk), where k=m+n. Assume that the input string S is given in an array S[1,,k]. Give a brief argument showing that your algorithm is correct. (b) [12 marks] Give an argument that your algorithm indeed has O(logk) running time, by formulating, explaining and solving an appropriate recurrence equation. Assume that each comparison or arithmetic operation takes constant time.