
Concept explainers
Write a Python function
def isSubArray(A,B)
which takes two arrays and returns True if the first array is a (contiguous) subarray of the second array, otherwise it returns False. You may solve this problem using recursion or iteration or a mixture of recursion and iteration.
For an array to be a subarray of another, it must occur entirely within the other one without other elements in between. For example:
- [31,7,25] is a subarray of [10,20,26,31,7,25,40,9]
- [26,31,25,40] is not a subarray of [10,20,26,31,7,25,40,9]
A good way of solving this problem is to make use of an auxiliary function that takes two arrays and returns True if the contents of the first array occur at the front of the second array, otherwise it returns False. Then, A is a subarray of B if it occurs at the front of B, or at the front of B[1:], or at the front of B[2:], etc. Note you should not use A == B for arrays.
![Write a Python function
def isSubArray (A, B)
which takes two arrays and returns True if the first array is a (contiguous) subarray of the second array, otherwise it returns False . You may solve this
problem using recursion or iteration or a mixture of recursion and iteration.
For an array to be a subarray of another, it must occur entirely within the other one without other elements in between. For example:
• [31,7, 25] is a subarray of [10,20, 26,31,7,25,40,9]
[26,31, 25,40] is not a subarray of [10,20,26,31,7,25,40,9]
Hint: A good way of solving this problem is to make use of an auxiliary function that takes two arrays and returns True if the contents of the first array occur at
the front of the second array, otherwise it returns False. Then, A is a subarray of B if it occurs at the front of B, or at the front of B[1:], or at the front of B[2:], etc.
Note you should not use A == B for arrays.](https://content.bartleby.com/qna-images/question/f756170d-2d1d-4a13-8a12-5e3152a86d82/1d0c6ed9-75d4-4dbb-b3cb-8315906a7edb/krunifd_thumbnail.png)

Step by stepSolved in 2 steps with 2 images

- in carrow_forwardWrite a RECURSIVE function, without using any loops, that prints the contents of a matrix with 3 columns. The function should take the matrix and the number of rows as arguments. void print_matrix(int arr[][3], int num_rows);arrow_forwardGiven an integer array of positive single digit values such as:int a[] = {8,4,2,6,9};1) Write a recursive arrayToN function which returns the concatenation of all array values as an integer value.This function should accept all required data as parameters and return a long integer value.ExamplesIf the array is 8 4 2 6 9 the arrayToN function returns the integer 84269.If the array is 0 2 6 8 9 3 5 1 the arrayToN function returns the integer 2689351.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





