Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

def tagi(start) : ***Assume that start is a bit string, such as '100100'. Generate a series of words where the first word is stort, and

image text in transcribed

def tagi(start) : ***Assume that start is a bit string, such as '100100'. Generate a series of words where the first word is stort, and each nes word is constructed from the previous word by the following rules: 1. if a word begins with , then append 30 and then delete the first three digits 2. If it begins with 1, then append 1101, and delete the first three digits. 3. if a word is the empty string, then do not change it For example, if start 1s 2111', then the series of words begins as follows: 1111 starting word 11101 append 1101 -> 11111102 then delete first three -> 11101 011101 append 1101 then delete first three digits 10100 append do then delete first three digits 001101 append 1102 the delete first three digits 20100 append oo then delete first three digits but this word tready occurred above, so s is the number of different words in the series Return the murder of words in the series before the next word is already in the series, or so, whichever is souter. For example, tegi1111) returns 5 (see one gove)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions