Question: Given an array A containing 0s and 1s, such that all the 0s appear in the array before all the 1s. Write an algorithm with

Given an array A containing 0s and 1s, such that all the 0s appear in the array before all the 1s. Write an algorithm with worst-case time complexity O(log(n)), which finds the smallest index i such that A[i] = 1. Describe your algorithm, and analyze its worst-case time complexity
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
