DATA STRUCTURE
Programming and Technical
Programming
Technical
Q.Two dimensional array elements are stored
a. System dependent
b. In Row major dependent
c. Compiler dependent
d. In column major dependent
Read Solution (Total 19)
-
- In row major dependent
- 9 years agoHelpfull: Yes(9) No(2)
- compiler dependent
- 8 years agoHelpfull: Yes(5) No(2)
- compiler dependent
- 9 years agoHelpfull: Yes(2) No(2)
- a 2d array is nothing but more than 1 1d array therefore the consecutive elements of the rows of the array are contiguous in memory so it has to be row major dependent
- 9 years agoHelpfull: Yes(2) No(2)
- compiler dependent
- 9 years agoHelpfull: Yes(2) No(1)
- compiler dependent
- 8 years agoHelpfull: Yes(2) No(0)
- compiler dependent
- 8 years agoHelpfull: Yes(2) No(0)
- C. compiler dependent
- 9 years agoHelpfull: Yes(1) No(1)
- in column major dependent
- 8 years agoHelpfull: Yes(1) No(1)
- in row major dependent
- 8 years agoHelpfull: Yes(1) No(1)
- Obviously it is dependent upon the compiler but Maximum a time it is found it is implemented in Row Major Order to reduce the swapping time of pages if loaded into the memory.
- 7 years agoHelpfull: Yes(1) No(0)
- system dependent
- 8 years agoHelpfull: Yes(0) No(1)
- c.compiler dependent
- 8 years agoHelpfull: Yes(0) No(1)
- c) Compiler Dependent
- 8 years agoHelpfull: Yes(0) No(0)
- compiler dependent
- 7 years agoHelpfull: Yes(0) No(0)
- Compiler dependent
- 6 years agoHelpfull: Yes(0) No(0)
- c. Compiler dependent
- 6 years agoHelpfull: Yes(0) No(0)
- In Row major dependent
- 6 years agoHelpfull: Yes(0) No(0)
- Ans is In Row major dependent
Explanation: Successive subscript operators designate an element of a multidimensional array object. If E is an n-dimensional array (n >= 2) with dimensions i x j x . . . x k, then E (used as other than an lvalue) is converted to a pointer to an (n - 1)-dimensional array with dimensions j x . . . x k. If the unary * operator is applied to this pointer explicitly, or implicitly as a result of subscripting, the result is the referenced (n - 1)-dimensional array, which itself is converted into a pointer if used as other than an lvalue. It follows from this that arrays are stored in row-major order (last subscript varies fastest). - 1 year agoHelpfull: Yes(0) No(0)
DATA STRUCTURE Other Question
In the game of Jack Straws, a number of plastic or wooden "straws" are dumped on the table and players try to remove them one-by-one without disturbing the other straws. In the question here, we are concerned with the following, related problem: First n straws are dumped on the table. Next, for every pair of straws, we want to determine if the straws are connected by a path of touching straws. In other words, given a list of the endpoints for n > 1 straws (as if they were dumped on a large piece of graph paper), determine all the pairs of straws that are connected. Note that touching is connecting, but also two straws can be connected indirectly via other connected straws. Give an algorithm to compute all the pairs of straws that are connected.
Here is some additional information that you can use:
i. As a basic step you need to determine whether two straws directly touch (intersect), i.e., whether straw ab with end points a and b intersects with straw cd (with end points c and d).
ii. To get full credit also explain how the elementary step i) can be done. If you cannot find an algorithm for this step, assume an O(n 2 ) algorithm and explain how to find all pairs of straws that are connected.
Analyse and explain the worst-case computational complexity of your algorithm in terms of n.
Can someone please tell some real time examples of insertion,heap,quick,merge,selection sort?