Data Structures & AlgorithmsHardGATE CS · DSA
A 2-D array A[0..11][0..29] of 4-byte elements is stored in row-major order starting at address 1000. What is the address of A[5][11]?
- A. 1644
- B. 1548
- C. 1524
- D. 1648
Correct answer: A. 1644
There are 12 rows and 30 columns. In row-major order the offset is ((i − (0))·30 + (j − (0))), times 4 bytes, giving 1644. Using the other order gives 1548.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- For the sorted array [1, 5, 6, 7, 7, 7, 8, 9, 9, 10, 10, 11] (0-based), what are lowerbound(9) (first index with value ≥ 9) and…
- Keys 13, 14, 24, 27, 70, 76, 91, 15 are inserted in this order into an empty hash table of size 13 with h(k) = k mod 13 and linear…
- Keys 55, 63, 47, 69, 16, 97, 39, 99, 77, 43 are inserted in this order into a chained hash table with 7 buckets, h(k) = k mod 7, and each…
- Floyd's cycle detection on a list whose last node links back into the list. What does this print (meeting value, cycle-start value, cycle…
- What does this loop-counting code print? (Python) python n, c = 70000, 0 i = 2 while i <= n: c += 1 i = i i print(c)
- In the binary array [1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0] you may flip at most 2 zeros to ones. What is the length of the longest run…