Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
26 views

Arrays Assignment Computer Science: Kendriya Vidyalaya HVF Avadi Chennai 600 054

This document contains an assignment on arrays and searching algorithms with 15 questions: 1) It asks how computer memory is allocated for a two-dimensional array and provides a formula to calculate the address of an element in a row-major 2D array. 2) It asks several questions about calculating addresses of elements in 2D arrays stored in both row-major and column-major order. 3) It provides function prototypes for functions to display elements of a 2D array divisible by 10 and to point to the upper half of a 2D array. 4) The final questions ask about binary search, its efficiency compared to linear search, and when it is applicable.

Uploaded by

vikas_2
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Arrays Assignment Computer Science: Kendriya Vidyalaya HVF Avadi Chennai 600 054

This document contains an assignment on arrays and searching algorithms with 15 questions: 1) It asks how computer memory is allocated for a two-dimensional array and provides a formula to calculate the address of an element in a row-major 2D array. 2) It asks several questions about calculating addresses of elements in 2D arrays stored in both row-major and column-major order. 3) It provides function prototypes for functions to display elements of a 2D array divisible by 10 and to point to the upper half of a 2D array. 4) The final questions ask about binary search, its efficiency compared to linear search, and when it is applicable.

Uploaded by

vikas_2
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

KENDRIYA VIDYALAYA HVF AVADI CHENNAI 600 054

Page 1 of 1

ARRAYS ASSIGNMENT
Computer Science
A.1.

How is computer memory allotted for a two-dimensional array?

2.

Each element of two-dimensional array (with 5 rows and 4 columns) is stored


in one memory location. If A (1, 1) is at location 2000, what is the address of A
(4, 4)? The arrangement is row-major. Use a suitable formula for the
calculation.
Calculate the address of X[4,3] in a two-dimensional array X[15,14]
stored in row-major order in the main memory. Assume the base address to be
1000 and that each element requires 4 words to storage.1
If an Array B[11][8] is stored as column wise and B[2,2] is stored at 1024 and
B[3,3] at 1084, find the address of B[5,3] and B[1,1].
Write a User-Defined function Upper-half ( ) which takes a two dimensional
array A , Which Size N rows and N columns as argument and point the upper
half of the array.
Write a user-defined function in c++ to display those element of a two
dimensional array M[5][5] which are divisible by 10. Assume the content of
array is already present and the function prototype is as follows:
Void Display10(int M[5][5]);

3.
4
5
6

An array X[7][20] is stored in the memory with each element requiring 2 bytes
of storage. If the base address of array is 2000, calculate the location of X[3][5]
when the array x is stored in column major order.

An array ARR[5][5] is stored in the memory with each element occupying 4


bytes of space. Assuming the base address of ARR to be 1000, compute the
address of ARR[2][4], when the array VAL is Stored (i) Row wise (ii) Column
Wise.
An Array M[30[10] is stored in the memory column wise with each element
occupying 8 bytes of memory. Find out the base address and the address of
element M[20][5], if the location of M[5][7] is stored at the address 1000.
WAP the Transpose of a two-dimensional matrix A [3][3].
WAP to search an element in Array using Binary Search.
WAP to Sort elements of Array using Bubble Sort.
WAP to Sort elements of Array using Insertion Sort.
WAP to Sort elements of Array using Selection Sort.
WAP to Add and multiply Two 3 X 3 matrix and store value in third 3 X 3
matrix.
State the condition(s) under which binary search is applicable.

9.
10
11
12
13
14
15
B.1
2

Comment on the efficiency of linear search and binary search in relation to the
number of elements in the list being searched.
3
Explain (i) Linear search method ( ii ) Binary Search method, which of two is
more efficient for stored data?
-----------------------------------Assignment Prepared By Tushar Thosar PGT CS
Date:11/22/2014

4 /3
marks

1/2
marks

You might also like