Q1. Illustrate the parameters on the basis of which an algorithm can be examined?
Q2. Describe Dijkstra’s algorithm for determining the shortest path in a given graph.
Q3. Suppose that the declaration of multidimensional arrays A and B to be, A (-2:2, 2:22) and B (1:8, -5:5, -10:5):
a) Determine the length of each dimension and the number of elements in A and B.
b) Consider the element B[3,3,3] in B. Determine the effective indices E1, E2, E3 and the address of element, supposing Base (B) = 400 and there are W = 4 words per memory location.
Q3. A nasty number is defined as a number that consists of at least two pairs of integer factors in such a way that the difference of one pair equivalents to sum of the other pair.
For illustration, the factors of ‘6’ are 1, 2, 3 and 6. The difference of factor pair (6, 1) is equivalent to the sum of factor pair (2,3), that is, 5. Therefore, ‘6’ is a nasty number.
Select suitable data structure and prepare a program which displays all the nasty numbers present in the list of numbers.
Q4. Use a stack to assess the given postfix arithmetic expression. Show the changing status of stack in a tabular form:
X Y Z ^ * + A B / C + - for X = 1, Y = 5, Z = 2, P=3, A = 15, B = 3, and C = 8