Menu
Question Index
...

Write a program to sort the given words in the 2D character array.

Input (Two dimensional char array) Output (Two dimensional char array)
{{a, p, p, l, e}, {a, p, p, s}, {b, a, n, a, n, a}, {o, r, a, n, g, e}, {m, a, n, g, o}, {w, a, t, e, r, m, e, l, o, n}, {g, r, a, p, e, s}, {c, o, c, o, n, u, t}} {{a, p, p, l, e}, {a, p, p, s}, {b, a, n, a, n, a},{c, o, c, o, n, u, t}, {g, r, a, p, e, s}, {m, a, n, g, o}, {o, r, a, n, g, e},{w, a, t, e, r, m, e, l, o, n}}
{{d, e, l, h, i}, {g, u, j, a, r, a, t}, {k, e, r, a, l, a}, {a, n, d, h, r, a, p, r, a, d, e, s, h}, {k, a, r, n, a, t, a, k, a}} {{a, n, d, h, r, a, p, r, a, d, e, s, h}, {d, e, l, h, i}, {g, u, j, a, r, a, t}, {k, a, r, n, a, t, a, k, a}, {k, e, r, a, l, a}}
{{l, i, l, l, y}, {l, o, t, u, s}, {r, o, s, e}, {s, u, n, f, l, o, w, e, r} {{l, i, l, l, y}, {l, o, t, u, s}, {r, o, s, e}, {s, u, n, f, l, o, w, e, r}}
{{g, o, o, g, l, e}, {y, a, h, o, o}, {o, r, k, u, t}, {f, a, c, e, b, o, o, k}, {t, w, i, t, t, e, r}, {g, m, a, i, l}} {{f, a, c, e, b, o, o, k}, {g, m, a, i, l}, {g, o, o, g, l, e}, {o, r, k, u, t}, {t, w, i, t, t, e, r}, {y, a, h, o, o}}
{{a, n, a, n, d}, {a, m, m, u}, {b, h, a, v, a, n, a}, {h, e, m, a}, {c, h, a, n, d, u}, {s, h, e, k, a, r}} {{a, m, m, u}, {a, n, a, n, d}, {b, h, a, v, a, n, a}, {c, h, a, n, d, u}, {h, e, m, a}, {s, h, e, k, a, r}}



class SortWords
{
    public static void main(String s[])
    {
        char[][] input = {{'a', 'p', 'p', 'l', 'e'}, {'a', 'p', 'p', 's'}, {'b', 'a', 'n', 'a', 'n', 'a'}, {'o', 'r', 'a', 'n', 'g', 'e'}, {'m', 'a', 'n', 'g', 'o'}, {'w', 'a', 't', 'e', 'r', 'm', 'e', 'l', 'o', 'n'}, {'g', 'r', 'a', 'p', 'e', 's'}, {'c', 'o', 'c', 'o', 'n', 'u', 't'}};
        sortWords(input);
        System.out.println("After sorting the words : ");
        for (char[] result : input) {
        System.out.println(result);
        }

    }


    private static void sortWords(char[][] input) {
    }
    

}

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App