@sravanreddy...logical bugs if A is size of n & B is size m from your example assuming n<m so if you want smallest m elements in A then u only capacity of n elements & didn't allocate memory so these elements initialized by INT_MIN for m-n nodes so that array A can hold m smallest elements then what r u swapping u dude..isn't garbage value ?? you will get at 1st step only just run it ?? in you algo A_End=m-1(which 4th position in Array that DNE)..?? & also you have to free memory for m-n in array B as it contains n largest elements .
take A= 1,2,3 n=3 B= 0,1,4,5,9 m=5 after allocating memory to Array A for m-n elements A will looks likes 1 2 3 INT_Max INT_Max now what you wants A should contains m smallest elements & B have n largest elements so O/P should be A=1,2,3,1,0 & B=INT_Max,INT_Max,4,5,9 now free memory used by 1st elements in array B so that A will represent M smallest elements & B will have n Largest elements so that above will work. Hope I am Correct let me know if any issue with explanation Thanks Shashank>>"The Best Way To Escape From The problem is To Solve It" CSE,BIT Mesra -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.