i need the code to return true if the target is in list and false otherwiselst=[0, 1, 2, 3, 697, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48]for example this is an almost sorted list the character 697 is misplacedthe input is always an almost sorted list (woth one misplaced character )
i tried to binary search the misplaced index or char but it didnt work because in binary search we 'halve ' the mid value or the interval we are looking into but there is no assurance that the target will be found at the new searching area , for example the target can be smaller than the char in the mid index and also smaller than the median but misplaced at the last index (n-1 for a list of length n )i need ideas or to provide me a code