Can you help me any of these? If you help me any of these entire one problem, i\
ID: 3639648 • Letter: C
Question
Can you help me any of these?If you help me any of these entire one problem, i'll give you life savior right away!
1. Reversing a 1-D array. Write a Python function that given an array A of numbers returns an
array B that has the elements of A in reverse order.
a. What should the output of the function be for A = {3, 2, 1, 5, 9}?
b. Write the Python function. Include detailed comments. The name of the function should
be def ReverseArray(A). B should be returned.
c. Evaluate the Python function for arrays of length 1, 5, and 10. Report each input and
output.
2. Fast searching in sorted array. Write a Python function which, given an array of numbers A
sorted in ascending order and a number a, returns true if a appears in A and false otherwise.
a. Write the Python function. Include detailed comments. The name of the function should
be def FastSearch(A, a). True or False should be returned.
b. Evaluate the function for a case when a is not present in A, when a is present in A, and
when there are multiple instances of a in A.
3. Compression. Write a Python function which, given an array of integers A, computes the
number of bits necessary to represent each number.
a. What should the output of the function be for A = {77, 78, 79, 78, 77, 80}?
b. Write the Python function. Include detailed comments. The name of the function should
be def Compress(A). A number should be returned.
c. Evaluate the function for A = {77, 78, 80, 80, 77, 81, 82, 80, 88, 87, 80, 80, 80, 77, 78, 79,
80, 81, 82, 83, 83, 84, 85, 86, 86}
4. Text editor function. Write a Python function which, given a long string A, a word string B, and a
word string C, replaces all occurrences of B in A with C and returns the modified string A.
a. Write the Python function. Include detailed comments. The name of the function should
be def Editing(A, B, C). The resulting string should be returned.
b. Evaluate the function for A = “The fix jumps over the fence. Another fix followed.” B =
“fix”, C = “fox”.
Explanation / Answer
1) use the reversed function. for eg. >>> array=[0,10,20,40] >>> for i in reversed(array): ... print i output of the function be for A = {3, 2, 1, 5, 9} 9, 5, 1, 2, 3