Re: [algogeeks] merge 2 sorted list into 1

2011-07-21 Thread nicks
i can't point out the mistake in algo but i can suggest you a good algo for the same a[] is the sorted array of size n b[] is the sorted array of size 2n in which n elements are absent. now shift all the elements of b[] to the end leaving the first n positions vacant(sorted order in b[] is still

[algogeeks] merge 2 sorted list into 1

2011-07-21 Thread vetri
question:given 2 sorted list: a's size=n and b's size=2*n but has only n elements. merge them into 1 single list. answer: i came up with dis but am gettin index out of bound exception. can u pls spot d mistake? import java.util.*; public class merge { static int a[],b[],size; public static vo