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

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..

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.

Recomendados

We discussed how defining macros in code is tedious and why .pdf por
We discussed how defining macros in code is tedious and why .pdfWe discussed how defining macros in code is tedious and why .pdf
We discussed how defining macros in code is tedious and why .pdfDARSHANACHARYA13
6 vistas1 diapositiva
We consider the exampie about two threads accessing a printe.pdf por
We consider the exampie about two threads accessing a printe.pdfWe consider the exampie about two threads accessing a printe.pdf
We consider the exampie about two threads accessing a printe.pdfDARSHANACHARYA13
7 vistas1 diapositiva
We ask you to perform the following calculations to determin.pdf por
We ask you to perform the following calculations to determin.pdfWe ask you to perform the following calculations to determin.pdf
We ask you to perform the following calculations to determin.pdfDARSHANACHARYA13
2 vistas1 diapositiva
We assume a function f is of the form ftk1nakkt where .pdf por
We assume a function f is of the form ftk1nakkt where .pdfWe assume a function f is of the form ftk1nakkt where .pdf
We assume a function f is of the form ftk1nakkt where .pdfDARSHANACHARYA13
2 vistas1 diapositiva
Wayne Corrugated Inc manufactures folding paperboard boxe.pdf por
Wayne Corrugated Inc manufactures folding paperboard boxe.pdfWayne Corrugated Inc manufactures folding paperboard boxe.pdf
Wayne Corrugated Inc manufactures folding paperboard boxe.pdfDARSHANACHARYA13
2 vistas1 diapositiva
We are planning to develop a system for A pediatrician clini.pdf por
We are planning to develop a system for A pediatrician clini.pdfWe are planning to develop a system for A pediatrician clini.pdf
We are planning to develop a system for A pediatrician clini.pdfDARSHANACHARYA13
4 vistas1 diapositiva

Más contenido relacionado

Más de DARSHANACHARYA13

Watch the videos below In these videos you will see the st.pdf por
Watch the videos below In these videos you will see the st.pdfWatch the videos below In these videos you will see the st.pdf
Watch the videos below In these videos you will see the st.pdfDARSHANACHARYA13
3 vistas1 diapositiva
Waste Disposal Systems has an aftertax cost of debt of 90 p.pdf por
Waste Disposal Systems has an aftertax cost of debt of 90 p.pdfWaste Disposal Systems has an aftertax cost of debt of 90 p.pdf
Waste Disposal Systems has an aftertax cost of debt of 90 p.pdfDARSHANACHARYA13
2 vistas1 diapositiva
Waste from the food ingested is eliminated via the colon and.pdf por
Waste from the food ingested is eliminated via the colon and.pdfWaste from the food ingested is eliminated via the colon and.pdf
Waste from the food ingested is eliminated via the colon and.pdfDARSHANACHARYA13
3 vistas1 diapositiva
Warning This game is purely for educational purposes and do.pdf por
Warning This game is purely for educational purposes and do.pdfWarning This game is purely for educational purposes and do.pdf
Warning This game is purely for educational purposes and do.pdfDARSHANACHARYA13
3 vistas1 diapositiva
WarmUp Check Your Understanding Fill in the blank with the.pdf por
WarmUp Check Your Understanding Fill in the blank with the.pdfWarmUp Check Your Understanding Fill in the blank with the.pdf
WarmUp Check Your Understanding Fill in the blank with the.pdfDARSHANACHARYA13
4 vistas1 diapositiva
Walmartn Amazon ve dier evrimii perakendecilerle rekabet .pdf por
Walmartn Amazon ve dier evrimii perakendecilerle rekabet .pdfWalmartn Amazon ve dier evrimii perakendecilerle rekabet .pdf
Walmartn Amazon ve dier evrimii perakendecilerle rekabet .pdfDARSHANACHARYA13
2 vistas1 diapositiva

Más de DARSHANACHARYA13(20)

Watch the videos below In these videos you will see the st.pdf por DARSHANACHARYA13
Watch the videos below In these videos you will see the st.pdfWatch the videos below In these videos you will see the st.pdf
Watch the videos below In these videos you will see the st.pdf
DARSHANACHARYA133 vistas
Waste Disposal Systems has an aftertax cost of debt of 90 p.pdf por DARSHANACHARYA13
Waste Disposal Systems has an aftertax cost of debt of 90 p.pdfWaste Disposal Systems has an aftertax cost of debt of 90 p.pdf
Waste Disposal Systems has an aftertax cost of debt of 90 p.pdf
DARSHANACHARYA132 vistas
Waste from the food ingested is eliminated via the colon and.pdf por DARSHANACHARYA13
Waste from the food ingested is eliminated via the colon and.pdfWaste from the food ingested is eliminated via the colon and.pdf
Waste from the food ingested is eliminated via the colon and.pdf
DARSHANACHARYA133 vistas
Warning This game is purely for educational purposes and do.pdf por DARSHANACHARYA13
Warning This game is purely for educational purposes and do.pdfWarning This game is purely for educational purposes and do.pdf
Warning This game is purely for educational purposes and do.pdf
DARSHANACHARYA133 vistas
WarmUp Check Your Understanding Fill in the blank with the.pdf por DARSHANACHARYA13
WarmUp Check Your Understanding Fill in the blank with the.pdfWarmUp Check Your Understanding Fill in the blank with the.pdf
WarmUp Check Your Understanding Fill in the blank with the.pdf
DARSHANACHARYA134 vistas
Walmartn Amazon ve dier evrimii perakendecilerle rekabet .pdf por DARSHANACHARYA13
Walmartn Amazon ve dier evrimii perakendecilerle rekabet .pdfWalmartn Amazon ve dier evrimii perakendecilerle rekabet .pdf
Walmartn Amazon ve dier evrimii perakendecilerle rekabet .pdf
DARSHANACHARYA132 vistas
Warren Buffett director ejecutivo del holding multinacional.pdf por DARSHANACHARYA13
Warren Buffett director ejecutivo del holding multinacional.pdfWarren Buffett director ejecutivo del holding multinacional.pdf
Warren Buffett director ejecutivo del holding multinacional.pdf
DARSHANACHARYA134 vistas
Walt Disney espera recibir una tarifa teatral de Mex16 mill.pdf por DARSHANACHARYA13
Walt Disney espera recibir una tarifa teatral de Mex16 mill.pdfWalt Disney espera recibir una tarifa teatral de Mex16 mill.pdf
Walt Disney espera recibir una tarifa teatral de Mex16 mill.pdf
DARSHANACHARYA132 vistas
WACC is 542 Firm Z has invested 4 million in marketing .pdf por DARSHANACHARYA13
WACC is 542   Firm Z has invested 4 million in marketing .pdfWACC is 542   Firm Z has invested 4 million in marketing .pdf
WACC is 542 Firm Z has invested 4 million in marketing .pdf
DARSHANACHARYA132 vistas
Walmart en todo el mundo Escuela de Negocios de Harvard Pr.pdf por DARSHANACHARYA13
Walmart en todo el mundo Escuela de Negocios de Harvard Pr.pdfWalmart en todo el mundo Escuela de Negocios de Harvard Pr.pdf
Walmart en todo el mundo Escuela de Negocios de Harvard Pr.pdf
DARSHANACHARYA133 vistas
Vulcan Flyovers offers scenic overfights of Mount Saint Hele.pdf por DARSHANACHARYA13
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
DARSHANACHARYA132 vistas
W them and Interference NOTE The mutant versions of these.pdf por DARSHANACHARYA13
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
DARSHANACHARYA134 vistas
Vulcan Flyovers offers scenic overflights of Mount Saint Hel.pdf por DARSHANACHARYA13
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
DARSHANACHARYA134 vistas
VSIM JOSEPHINE MORROW La reflexin est destinada a reforza.pdf por DARSHANACHARYA13
VSIM JOSEPHINE MORROW  La reflexin est destinada a reforza.pdfVSIM JOSEPHINE MORROW  La reflexin est destinada a reforza.pdf
VSIM JOSEPHINE MORROW La reflexin est destinada a reforza.pdf
DARSHANACHARYA134 vistas
Vincent Company supplies schools with floot matiresses to us.pdf por DARSHANACHARYA13
Vincent Company supplies schools with floot matiresses to us.pdfVincent Company supplies schools with floot matiresses to us.pdf
Vincent Company supplies schools with floot matiresses to us.pdf
DARSHANACHARYA132 vistas
vs H1pp0 for some known quantity p001 Based on Questi.pdf por DARSHANACHARYA13
vs H1pp0 for some known quantity p001 Based on Questi.pdfvs H1pp0 for some known quantity p001 Based on Questi.pdf
vs H1pp0 for some known quantity p001 Based on Questi.pdf
DARSHANACHARYA132 vistas
Viviane performs a noncompartmental analysis She reports t.pdf por DARSHANACHARYA13
Viviane performs a noncompartmental analysis She reports t.pdfViviane performs a noncompartmental analysis She reports t.pdf
Viviane performs a noncompartmental analysis She reports t.pdf
DARSHANACHARYA132 vistas
viguifcanon levei for al parte Tent the claim trat the teo .pdf por DARSHANACHARYA13
viguifcanon levei for al parte Tent the claim trat the teo .pdfviguifcanon levei for al parte Tent the claim trat the teo .pdf
viguifcanon levei for al parte Tent the claim trat the teo .pdf
DARSHANACHARYA132 vistas
Verdadero Falso 5_____ Las actividades de apoyo del sistem.pdf por DARSHANACHARYA13
Verdadero Falso  5_____ Las actividades de apoyo del sistem.pdfVerdadero Falso  5_____ Las actividades de apoyo del sistem.pdf
Verdadero Falso 5_____ Las actividades de apoyo del sistem.pdf
DARSHANACHARYA132 vistas
Victory Company uses weighted average process costing The c.pdf por DARSHANACHARYA13
Victory Company uses weighted average process costing The c.pdfVictory Company uses weighted average process costing The c.pdf
Victory Company uses weighted average process costing The c.pdf
DARSHANACHARYA133 vistas

Último

Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptx por
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCollective Bargaining and Understanding a Teacher Contract(16793704.1).pptx
Collective Bargaining and Understanding a Teacher Contract(16793704.1).pptxCenter for Integrated Training & Education
93 vistas57 diapositivas
When Sex Gets Complicated: Porn, Affairs, & Cybersex por
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & CybersexMarlene Maheu
67 vistas73 diapositivas
Drama KS5 Breakdown por
Drama KS5 BreakdownDrama KS5 Breakdown
Drama KS5 BreakdownWestHatch
79 vistas2 diapositivas
Recap of our Class por
Recap of our ClassRecap of our Class
Recap of our ClassCorinne Weisgerber
77 vistas15 diapositivas
Ch. 7 Political Participation and Elections.pptx por
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptxRommel Regala
97 vistas11 diapositivas
Sociology KS5 por
Sociology KS5Sociology KS5
Sociology KS5WestHatch
70 vistas23 diapositivas

Último(20)

When Sex Gets Complicated: Porn, Affairs, & Cybersex por Marlene Maheu
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & Cybersex
Marlene Maheu67 vistas
Drama KS5 Breakdown por WestHatch
Drama KS5 BreakdownDrama KS5 Breakdown
Drama KS5 Breakdown
WestHatch79 vistas
Ch. 7 Political Participation and Elections.pptx por Rommel Regala
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptx
Rommel Regala97 vistas
Sociology KS5 por WestHatch
Sociology KS5Sociology KS5
Sociology KS5
WestHatch70 vistas
Psychology KS4 por WestHatch
Psychology KS4Psychology KS4
Psychology KS4
WestHatch84 vistas
Structure and Functions of Cell.pdf por Nithya Murugan
Structure and Functions of Cell.pdfStructure and Functions of Cell.pdf
Structure and Functions of Cell.pdf
Nithya Murugan545 vistas
Class 10 English notes 23-24.pptx por TARIQ KHAN
Class 10 English notes 23-24.pptxClass 10 English notes 23-24.pptx
Class 10 English notes 23-24.pptx
TARIQ KHAN131 vistas
Create a Structure in VBNet.pptx por Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P75 vistas
Classification of crude drugs.pptx por GayatriPatra14
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptx
GayatriPatra1486 vistas
Use of Probiotics in Aquaculture.pptx por AKSHAY MANDAL
Use of Probiotics in Aquaculture.pptxUse of Probiotics in Aquaculture.pptx
Use of Probiotics in Aquaculture.pptx
AKSHAY MANDAL100 vistas
Are we onboard yet University of Sussex.pptx por Jisc
Are we onboard yet University of Sussex.pptxAre we onboard yet University of Sussex.pptx
Are we onboard yet University of Sussex.pptx
Jisc96 vistas
Scope of Biochemistry.pptx por shoba shoba
Scope of Biochemistry.pptxScope of Biochemistry.pptx
Scope of Biochemistry.pptx
shoba shoba133 vistas
Psychology KS5 por WestHatch
Psychology KS5Psychology KS5
Psychology KS5
WestHatch93 vistas

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.