Search:

Type: Posts; User: mia_tech

Search: Search took 0.07 seconds.

  1. Replies
    9
    Views
    16,659

    [SOLVED] Re: counting number of comparisons in merge sort

    the answer is 23 for this array
  2. Replies
    9
    Views
    16,659

    [SOLVED] Re: counting number of comparisons in merge sort

    ok, I forgot that 25 is worst case scenario in which you need to compare all numbers, but here are the numbers I'm comparing. could you tell me what's the number of comparison you get

    45 62 98 89...
  3. Replies
    9
    Views
    16,659

    [SOLVED] Re: counting number of comparisons in merge sort

    so, how many comparison does it take using merge sort to sort an array of 10 numbers?... I got 26, what do you get?
    by doing like you told me gives me only 12 comparison, and I know is more than...
  4. Replies
    9
    Views
    16,659

    [SOLVED] Re: counting number of comparisons in merge sort

    I think you might be right ;0)
  5. Replies
    9
    Views
    16,659

    [SOLVED] Re: counting number of comparisons in merge sort

    if you take a look at mergeSort method it has two recursive calls in it, so every time merge is called it reset i = 0, so you need some sort of class variable to keep track of total i's
  6. Replies
    9
    Views
    16,659

    [SOLVED] Re: counting number of comparisons in merge sort

    yeah, that's exactly what I did... well, kind of, my mergeSorter is inside the while loop, in other words everytime loops is comparing, but yours is outsid the while loop, which gives a different...
  7. Replies
    9
    Views
    16,659

    [SOLVED] counting number of comparisons in merge sort

    guys, I have the following merge sort algorithm, and I'm trying to count the number of comparison that is has to do in order to sort the whole array. I know the formula, I just don't know where to...
Results 1 to 7 of 7