Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7870473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:37:55+00:00 2026-06-03T01:37:55+00:00

I was going over the 2 way merge sort algorithm and was thinking if

  • 0

I was going over the 2 way merge sort algorithm and was thinking if by reducing the merge passes can we get better gain in terms of time.

E.g in a 2 way merge we have the following recurrence:

T(n) = 2T(n/2) + O(n)

and this has a time complexity of N.log-base2(N)

if I divide the problem by 4 and merge 4 sub arrays I will get

T(n) = 4T(n/4) + O(n)

and this should have a time complexity of N.log-base4(N)

Since, the number of merge passes has reduced, should this be something to consider when implementing merge sort ?

e.g with an array of 64 elements the first approach will have 6 passes and using the second approach it will have 3 passes.

Edit:

Ok, so with 2T(n/2) we are doing N comparisons per pass and with 4T(n/4) we end up doing 3*N comparisons per pass ? What about the cost of moving elements to result arrary, does that remain same at each pass ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:37:58+00:00Added an answer on June 3, 2026 at 1:37 am

    Note that the base-4 log of a number is exactly half the base-2 log of a number; thus, you’re only introducing a constant-factor speedup. Except you’re not, because you introduce a similar constant-factor SLOWDOWN in the cost of the actual merging (2-way merge needs 1 comparison per item, 4-way may need up to 3). So while there may be fewer passes, the passes are each more costly. So you’ve complicated the code a fair bit, and the benefits are in question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a big merge going on with over 300 conflicting files. I want
I've been pulling my hair out (and going way over allotted hours) to try
I've been going over and over this in my head, and I can't seem
I am going over/studying the facebook code that was leaked in 2007, I notice
I'm going over the jquery widget here: http://blog.davidpadbury.com/2010/10/11/bdd-testing-of-jquery-plugins-using-jasmine/ The plugin is called like so:
I am going over a past paper for a database course I am taking
So we start Scrum today and start going over story points estimates. The first
I've moved to a new project team and while going over the codebase, found
as we know, the loop X instruction is going over X until ECX =
I'm going back over an old project where I added preprocessor functionality to Essence'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.