iterating over first i . e 0 th column and connecting Node .
else if ( i <= n - 1 && j == 0 ) { i = i - 1 temp . top = new Node ( grid [ i ] [ j ] ) temp = temp . top if ( i == 1 ) temp . top = this . head } } }