Page 313 - Cs_withBlue_J_C11_Flipbook
P. 313

33                  }
                   34              }

                   35              else
                   36              {

                   37                  System.out.println(n+" not found");
                   38              }

                   39          }
                   40      }


                 The output of the preceding program is as follows:
                 Output 1:
                 Enter a number: 23
                 Enter a number: 24
                 Enter a number: 25
                 Enter a number: 26
                 Enter a number: 27
                 Enter a number to be deleted:
                 25
                 23 24 26 27 0

                 Output 2:
                 Enter a number: 23
                 Enter a number: 36
                 Enter a number: 65
                 Enter a number: 45
                 Enter a number: 47

                 Enter a number to be deleted:
                 32
                 32 not found

                     11.7 MERGING
                 Merging is the process of combining two or more arrays. It maintains the order of both arrays in the merged array. For
                 example, 1, 2, 3 and 4 are the elements of the first array and 8, 9, 10 and 11 are the elements of the second array. Then
                 1, 2, 3, 4, 8, 9, 10 and 11 are the elements of the new merged array.

                 Here two array elements are merged and a new array is created. Suppose the two arrays are ar1 and ar2.

                                     Index         0          1           2           3           4
                                      Ar1         10          5           14          7          66

                                     Index         0          1           2
                                      Ar2         11          22          33






                                                                                                                       311
                                                                                                              Arrays   311
   308   309   310   311   312   313   314   315   316   317   318