Question
Let X[1..n] be a binary array. A 1-burst is a substring of consecutive 1s (in X) such that there is a 0 on each end
Let X[1..n] be a binary array. A 1-burst is a substring of consecutive 1s (in X) such that there is a 0 on each end of the string (or the substring reaches one end of X). For example, if X = 0110111010111101 then X has five 1-bursts (the underlined strings): 0110111010111101. If X = 11111, then if X has one 1-burst (the entire string). a) Give a recursive algorithm (in pseudo code) that computes the position and length of the longest 1-burst in X. (Your algorithm should split the input into two halves.) b) Give and analyze (time complexity) a non-recursive algorithm for the same problem
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started