You are not logged in. Please login at www.codechef.com to post your questions!

×

Help needed in mergesort

hello my friend coders,can anybody please tell me whats wrong with my implementations .Thank you

asked 19 Mar '15, 18:43

chotabheemmc's gravatar image

2★chotabheemmc
637
accept rate: 28%


intitially you need to divide the complete array then you have to copy values based on comparision link:http://ideone.com/XR9S0e

link

answered 19 Mar '15, 18:58

pallesai's gravatar image

4★pallesai
176830
accept rate: 17%

thanks a lot...but it would be best if you can tell me what's wrong with my code.thanks in advance

(19 Mar '15, 19:05) chotabheemmc2★

i think there is small mistake but just can't find it

(19 Mar '15, 19:07) chotabheemmc2★

in your code, the statement int n=sizeof(a)/sizeof(a[0])-1; gives incorrect size of array

link

answered 19 Mar '15, 19:31

pritam1's gravatar image

3★pritam1
1
accept rate: 0%

thank you..but then what int n=sizeof(a)/sizeof(a[0]); still the same

(19 Mar '15, 19:35) chotabheemmc2★

int n=sizeof(a)/sizeof(a[0])-1; will work only iff you are dealing with arrays not received as parameters.so, you better pass another parameter such as low and high to determine the segment of original array

link

answered 19 Mar '15, 19:46

pritam1's gravatar image

3★pritam1
1
accept rate: 0%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×149

question asked: 19 Mar '15, 18:43

question was seen: 734 times

last updated: 19 Mar '15, 19:46