SlideShare une entreprise Scribd logo
1  sur  1
Télécharger pour lire hors ligne
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.

Contenu connexe

Plus de 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
 

Plus de 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
 

Dernier

BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
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
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
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
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
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
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 

Dernier (20)

BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
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
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
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
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
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
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 

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.