Question

A Young tableau is a 2D array of integers increasing from left to right and from top to bottom. Any unfilled entries are marked with ∞\infty, and hence there cannot be any entry to the right of, or below a ∞\infty. The following Young tableau consists of unique entries.

12514
34623
10121825
31∞\infty∞\infty∞\infty

When an element is removed from a Young tableau, other elements should be moved into its place so that the resulting table is still a Young tableau (unfilled entries may be filled in with ∞\infty). The minimum number of entries (other than 1) to be shifted, to remove 1 from the given Young tableau is _____.

Official answer and solution
Official answer
5
From
Official GATE 2015 answer key

Solution

Simulate the standard Young tableau deletion procedure starting at (0,0)(0, 0).

Deleting the minimum element 11 at cell (0,0)(0, 0) leaves a vacancy. To restore the Young tableau invariant, repeatedly compare the right neighbor (r,c+1)(r, c+1) and the bottom neighbor (r+1,c)(r+1, c), shifting the smaller of the two into the vacant cell (r,c)(r, c).

Trace of shifts:

  1. At (0,0)(0, 0), right neighbor is (0,1)=2(0, 1) = 2, down neighbor is (1,0)=3(1, 0) = 3.
    • min⁡(2,3)=2\min(2, 3) = 2. Shift 22 from (0,1)(0, 1) to (0,0)(0, 0). Vacancy moves to (0,1)(0, 1). (Shift 1)
  2. At (0,1)(0, 1), right neighbor is (0,2)=5(0, 2) = 5, down neighbor is (1,1)=4(1, 1) = 4.
    • min⁡(5,4)=4\min(5, 4) = 4. Shift 44 from (1,1)(1, 1) to (0,1)(0, 1). Vacancy moves to (1,1)(1, 1). (Shift 2)
  3. At (1,1)(1, 1), right neighbor is (1,2)=6(1, 2) = 6, down neighbor is (2,1)=12(2, 1) = 12.
    • min⁡(6,12)=6\min(6, 12) = 6. Shift 66 from (1,2)(1, 2) to (1,1)(1, 1). Vacancy moves to (1,2)(1, 2). (Shift 3)
  4. At (1,2)(1, 2), right neighbor is (1,3)=23(1, 3) = 23, down neighbor is (2,2)=18(2, 2) = 18.
    • min⁡(23,18)=18\min(23, 18) = 18. Shift 1818 from (2,2)(2, 2) to (1,2)(1, 2). Vacancy moves to (2,2)(2, 2). (Shift 4)
  5. At (2,2)(2, 2), right neighbor is (2,3)=25(2, 3) = 25, down neighbor is (3,2)=∞(3, 2) = \infty.
    • min⁡(25,∞)=25\min(25, \infty) = 25. Shift 2525 from (2,3)(2, 3) to (2,2)(2, 2). Vacancy moves to (2,3)(2, 3). (Shift 5)
  6. At (2,3)(2, 3), down neighbor is (3,3)=∞(3, 3) = \infty, right is boundary. The vacancy is filled with ∞\infty.

The elements shifted into place are 2,4,6,18,252, 4, 6, 18, 25.
The total number of shifted entries (other than 1) is 5.

Final answer

5

Common trap

Counting the removal of 1 as one of the shifts, answering 6 instead of 5.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 2
Question
41 of 65, printed as CS Q.31
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.