CBSE Computer Science - Revision Tour(Solved) CBSE Guess > eBooks > Class XII > CBSE Computer Science Arrays Solved Revision Tour By Mr. Ravi Kiran COMPUTER SCIENCE ARRAYS DELHI 2002: 3.a) Define array and pointer. Solution: An array refer to a named list of a finite number n of similar data elements. Each of the data elements can be referenced respectively by a set of consecutive numbers. Arrays can be one dimensional, two dimensional or multi dimensional. An array can be declared as : Syntax: data_type Array_name[size]; Eg: int A[10]; //Then location of the//array are A[0], A[1],…….A[9]. 3.d) The array A[20][10] is stored in the memory with each element requiring one byte of storage if the base address of a is 0, determine the location of A[10][5] when the array A is stored by column major. Solution: Children, Try this answer as an assignment. 3.c) Considering the following key set: 42,29,74,11,65,58, use insertion sort to sort the data in ascending order and indicate the sequences of steps required. Solution:In this, Suppose an array A with n elements A[1],A[2],…A[N] is in memory. The insertion sort algorithm scans A from A[1] to A[N], insertion each element A[K] into its proper position in the previously sorted subarray A[1],A[2],…,A[K-1]. This sorting algorithm is frequently used when n is small.
DELHI 2001 3.a) Given two arrays of integers X and Y of sizes m and n respectively. Write a function named MERGE() which will third array named Z, such that the following sequence is followed.
Eg. X is {3, 2, 1, 7, 6, 3} and {9, 3, 5, 6, 2, 8, 10} the resultant array Z is
{3, 1, 7, 3, 9, 3, 5, 10, 8, 2, 6, 6, 2}
CBSE Computer Science Solved Revision Tour By Mr. Ravi Kiran ( [email protected] ) |
|