Prove that in a bit string the string 01 occurs at most one

Prove that in a bit string, the string 01 occurs at most one more time than the string 10.

Solution

There can be two possible cases for the bit string

Case 1: String doesn\'t contain the bit pattern \"10\"

hence the string will be of the form

0*1* where * represents there will be continuous flow of 0\'s and continuous flow of 1\'s in the second *

Hence number of 01 pairs will be equal to 1

number of 0,1 pairs = 1 <= number of 1-0 pairs + 1

Hence the case 1 holds true

Case 2: String contains the patter 10

Method: Divide the string into two halves such that 1 is in the left substring and 0 is in the right substring

let s be the complete string and a,b be the sub-strings

then number of 0,1 pairs in a <= number of 1,0 pairs in a + 1

then number of 0,1 pairs in b <= number of 1,0 pairs in b + 1

adding both the equations we get

number of 0,1 pairs in s = number of 1,0 pairs in a + number of 1,0 pairs in b + 2 <= number of 1,0 pairs s + 1

Hence the given case also holds true

Therefore, we get that in a bit string, the string 01 occurs at most one more time than the string 10

Prove that in a bit string, the string 01 occurs at most one more time than the string 10.SolutionThere can be two possible cases for the bit string Case 1: Str

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site