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 6665821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:45:49+00:00 2026-05-26T02:45:49+00:00

My answer was: Shell sort makes redundant comparison because if during comparison for elements

  • 0

My answer was:

Shell sort makes redundant comparison because if during comparison for elements far apart (when h is around 8), it compare two elements that are going to be neighbor, then is going to compare the same element again when during comparison for element near each other (when h is around 1). For example if the list is 113 400 818 612 112 311 412 429, when h = 4, it will compare 113 and 112, and when h = 1, it will compare 113 and 112 again since it will compare elements that are closest to each other.

Is my answer correct?

  • 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-05-26T02:45:50+00:00Added an answer on May 26, 2026 at 2:45 am

    Your example is definitely one where redundancy happens. In fact, redundancy cannot be avoided in Shell Sort. As you noticed, when h = 1, it always compares something that has been compared in previous preprocesses. One thing you can do to improve the performance of Shell Sort (i.e., reduce redundant comparisons) is choose h’s smartly. For example, if you choose h to be 4, 2, 1, then 113 and 112 have to be compared three times while if you choose h to be 5, 3, 1, the redundant comparisons are significantly reduced. The general rule for picking h’s is don’t pick powers of 2 and don’t pick multiples of one another. Hope this helps.

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

Sidebar

Related Questions

This answer says that Linq is targeted at a slightly different group of developers
An answer to a Stack Overflow question stated that a particular framework violated a
This answer to a question about C++ unit test frameworks suggests a possibility that
There are times that I automagically create small shell scripts from Python, and I
Have a question that I can't seem to find an answer for. I am
I'm writing a webapp that basically allows users to kick off shell scripts with
Tried using the answer found here: How to run 'cd' in shell script and
I am developing an Isolated Shell that caters to designers/special content creators performing specific
How do I write a shell script that will ask a question and then
We have a shell script that expects multiple user inputs to be entered when

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.