hi harsh,
u r using merge(), which is implementaion specific!!Cheers,
siva.
On 5/5/06, harsh [EMAIL PROTECTED] wrote:
This is clearly O(N*N)I will give you an O(N*log(N)) algorithm..Stack sort(Stack S, int N){// N is the number of elements in thestackStack s1 = new Stack();for (int i=0;iN/2;i++){
Hi negi!
forget abt stable sort, your code wud not even do simple sort.
e.g. try
your code on a[]={0,1,0} , it doesn't sort it as a[j] never a[i].
cheers,
siva.On 5/5/06, Cool_Happy [EMAIL PROTECTED] wrote:
i think this sort the array in linear time..if this snippet has any error do let me
-- Forwarded message --From: [EMAIL PROTECTED]
[EMAIL PROTECTED]Date: Apr 23, 2006 12:57 PMSubject: Posting error: Algorithm GeeksTo: [EMAIL PROTECTED]You do not have permission to post to group algogeeks. You may need to join
the group before being allowed to post, or this group