Page 30 - C++
P. 30

Ans

























                     (1 Mark for creating new node)
                     (½ Mark for entering values for the new node)

                     (½ Mark for assigning NULL value to the new node)
                     (½ Mark for assigning Front to the first node)

                     (½ Mark for linking the last node to the new node)

                     (1 Mark for assigning Rear to the new node)
               (d)   Write the definition of a user-defined function REPEAT_ROW(int A[][3],int R, int C)            2

                     in C++ that will store the elements in the following manner
                                                                                   st
                                                         st
                         1.  All row elements except the 1  element replaced by the 1  element,
                                                         st
                                                              nd
                                                                                         nd
                         2.  All row elements except the 1  & 2  element replaced by the 2  element,
                                                         st
                                                             nd
                                                                                             rd
                                                                   rd
                         3.  All row elements except the 1  , 2  & 3  element replaced by the 3  element and
                            so on.
                     For example: if initially the array was:-
                                            5        6       10       2
                                            2        6        9       12

                                            18      14        5       6

                     Then, the contents of the array after execution of the above function will be:-

                                            5        5       5        5
                                            2        6        6       6

                                            18      14        5       5







                                                        Page No. 13
   25   26   27   28   29   30   31   32   33   34   35