ProgrammingHard
The number of ways to choose a 2 x 2 submatrix in a 4 x 4 matrix (choosing consecutive rows and columns) is what?
- A. 9
- B. 16
- C. 4
- D. 12
Correct answer: A. 9
A 2 x 2 block is set by its top-left corner, which can be any of the 3 x 3 positions where it fits. So there are 9.
More C Programming questions
- Which of these statements about in-place transposition is correct?
- A table of size 5 uses h(k) = k % 5 with linear probing. Keys 15, 5, 10 and 3 are inserted in that order. How many slots are examined when…
- A hash table of size 5 uses h(k) = k mod 5 with linear probing. The keys 5, 10, 15 and 3 are inserted in that order into an empty table…
- A chained table has 4 buckets with h(k) = k % 4. Keys 1 and 5 are inserted with head insertion. Which key is first in bucket 1?
- A hash table starts with capacity 8 and doubles whenever the count exceeds half the capacity. After 9 insertions, what is the capacity?
- In a linear-probing table, slot 1 holds a tombstone and slot 2 holds key 6. A search for 6 begins at slot 1 (its hash). How many slots are…