Answered step by step
Verified Expert Solution
Question
1 Approved Answer
python please problem 1. roblem 1 [12 points ] Maximum adjacent repeats. In some applications, such as in computational biology, it is necessary to find
python please
roblem 1 [12 points ] Maximum adjacent repeats. In some applications, such as in computational biology, it is necessary to find the maximum number of times that adjacent repeats of a particular substring occur in a string. For example, - in the string "abxxcabxaaaxcabxxxxc", the maximum number of adjacent repeats of the substring " x " is 4 and it starts at index 15. (The adjacent repeats of " x " are underlined here: "abxxcabxaaaxcabxxxxc".) - in the string "acababaxyzababababababdexayababababxyz", the maximum number of adjacent repeats of the subatring " ab " is 6 and it starts at index 10. (The adjacent repeats of "ab" are underlined here: "acababaxyzababababababdexayababababxyz".) Implement a function called max_adjacent repeats with two parameters: - text_atr, the main text string - search_atr, the substring whose maximum adjacent repeats in text_atr we want to find The finction shonk return two values the maximum number of aljacent repetitions of Bearch_str in text ber and the index of text_ptr at which that maximum starte. If the inaximam repetition occurs mutliple times in the string, your code dhould return the smallest: indes at which it oceurs. Two fample runs are shown below: Two samble rums are shown below: from problem 1 import * max adjacent_repeats ("abxxcabxaaaxcabxxxxc", "x") (4,15) (6, max adjacent_repeats ("acababaxyzababababababdexayababababxyz", "ab") (6,10) Important notes: You may not use the multiplication operator on strings in your implementation for this function; i.e., you may not use the strategy of checking if search_str * k (for some integer k) occurs in text_str problem 1.
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