Below is a Python function definition for a linear search of a list Ist for element . It returns the first index at which element can be found in the...
could you please help with these two problems??? thank you could you please help with these two problems??? thank you
Below is a Python function definition for a linear search of a list Ist for element . It returns the first index at which element can be found inthe list ( or None ) if element is not in the list .def Linear Search ( 1 st , element ) :2 = 0for item in Ist :"if element = = item :"return Ielse :"2 + = 1return NoneWrite a similar MATLAB function linear Search .m . Your MATLAB function should take as parameters an unsorted list of non - negativeintegers , and an integer value , and returns the index where that value is first located in the list . ( No argument testing is required . ) Unlike thePython code which returns None if the value is not in the array , your MATLAB function should return the value - 1 if the value is not found .
Show more