Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem Description: Consider strings that can be split so that their first half

ID: 3879335 • Letter: P

Question

Problem Description:

Consider strings that can be split so that their first half is the same as their second half (ignoring blanks, punctuation, and case). For example, the string "booboo" can be split into "boo" and "boo". Another example is "hello, hello". After ignoring blanks and the comma, the two halves of the string are the same. However, the string "rattan" has unequal halves, as does the string "abcab". Describe how you could use a queue to test whether a string has =his property.

Analysis:(Describe the problem including input and output in your own words.)

Design: (Describe the major steps for solving the problem.)

Testing:(Describe how you test this program)

Explanation / Answer

Analysis : According to above problem an input string is given to us. and we have to find out the string from that given string such that our string does having only letters into that. Then we divide our coming string into two equal parts. Now, we have to check divided both string are equal or not. For example : Input String : "booboo" Making above string without any special charachters (blanks, punctuation, and case). NewString = "booboo" Dividing the newString into two equal parts. FirstHalf = "boo" SecongHalf = "boo" Output : The two halves of the string are the same. For example : Input String : "hi-bye,hi,bye" Making above string without any special charachters (blanks, punctuation, and case). NewString = "hibyehibye" Dividing the newString into two equal parts. FirstHalf = "hibye" SecongHalf = "hibye" Output : The two halves of the string are the same. For example : Input String : "abcab" Making above string without any special charachters (blanks, punctuation, and case). NewString = "abcab" Dividing the newString into two equal parts. As NewString length is not a even, We cannot divide the NewString into two halves. Output : The two halves of the string are not the same. Design : Steps for solve the Problem. 1. Take a input string into a variable (inputString). 2. Traverse the inputString from 0 index to inputString.Length. 3. If inputString having any special character the remove it from string and store new string to a variable (newString). Loop inpitString[0...inputString.Length] if inputString[index] is a letter then newString[index] = inputString[index] otherwise continue end if end loop 4. check If newString.Length is odd then two halves are not the same. 5. Otherwise Divide the newString into two haves. mid = newString.Length/2; 6. Two haves are Firsthalf[0..mid] Secondhalf[mid...newString.Length] 7. Compare firstHalf and SecondHalf if equal then Two halves are equal. otherwise not. Note: You can implement above steps in any language. Testing : 1. We can test your input whether a string is passed or not. 2. We can check mid value is actually mid point of our length or not. 3. check the two halves are same or not.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote