hi i want to do a program for mway search( external sorting),displaying each step of sort in java, can any one of you please help me, i am a starter in java.

thanks in advance

Hi everyone,

I don't really understand your question. Maybe you can try and explain a little more in detail

Richard West

the given data will bestored in a .dat file and the o/p should contain following things:

X is also accepted from console
Given 7 15 8 14 3 1 19 11 13 6 10 12 2 5 4 16 17 18 9 on tape 1 and assuming that only X=4 items can fit in RAM at a time. The sort may be performed as follows:
T1: {7 15 8 14 3 1 19 11 13 6 10 12 2 5 4 16 17 18 9}
T2:
T3: {7 8 14 15} {6 10 12 13} {9 17 18} T3, T4 after 1st pass. T1 is
T4: {1 3 11 19} {2 4 5 16} rewound for re-use.


After 2-way merge of the sorted groups from T3, T4 into T1 and T2
T1: {1 3 7 8 11 14 15 19} {9 17 18}
T2: {2 4 5 6 10 12 13 16}

T3, T4 are rewound for re-use. 2-Way merge of T1, T2 into T3 and T4
T3: {1 2 3 5 6 7 8 9 10 11 12 13 14 15 16 19}
T4: {9 17 18}

The last step is the 2-Way merge of T3, T4 into T1
T1: {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.