Question number 3 Data Structures Arrays & Stacks , Queues ARRAYS Row major method Address A[I][J] = Base + S* [ (I-Lr)*N+(J-Lc) ] ( N is no of columns) Column major method Address A[I][J] = Base + S* [ (I-Lr)+(J-Lc)*N ] (N is no of rows) 1) Write a function in C++, which accepts an integer array and its size as parameters and rearranges the array in reverse. Example :If an array of 9 elements initially contains the elements as 4, 2, 5, 1, 6,7, 8, 12, 10 Then the function should rearrange the array as 10,12, 8, 7, 6, 1, 5, 2, 4 2) An array Arr[40][10] is store in the memory along the column with each element occupying 4 bytes. Find out the base address of the location Arr[3][6] if the location Arr[30][10] is stored at the address 9000. 3) Write a function in C++ to print the product of each column of a two dimensional array passed as the arguments of the function. Example : If the two dimensional array co...
Posts
Showing posts from 2018