Question: Given an array s[0],,s[n-1] such that n > 1 and s[i] s[i+1] for all i. Write an algorithm in Python that inserts an input value
Given an array s[0],,s[n-1] such that n > 1 and s[i] s[i+1] for all i. Write an algorithm in Python that inserts an input value x into the array so that s[i] s[i+1] for all i.
array = [1,3,5,7,9,11,13,15]
def orderInsert(a,value):
#todo
orderInsert(array,18)
print(array)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
