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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:55:44+00:00 2026-05-27T22:55:44+00:00

this is a homework question, and I’m not that at finding the complixity but

  • 0

this is a homework question, and I’m not that at finding the complixity but I’m trying my best!

  • Three-way partitioning is a modification of quicksort that partitions elements into groups smaller than, equal to, and larger than the pivot. Only the groups of smaller and larger elements need to be recursively sorted. Show that if there are N items but only k unique values (in other words there are many duplicates), then the running time of this modification to quicksort is O(Nk).

my try:

on the average case:

the tree subroutines will be at these indices:

I assume that the subroutine that have duplicated items will equal (n-k)

  • first: from 0 – to(i-1)
  • Second: i – (i+(n-k-1))
  • third: (i+n-k) – (n-1)
  • number of comparisons = (n-k)-1

So,

T(n) = (n-k)-1 + Sigma from 0 until (n-k-1) [ T(i) + T (i-k)]

then I’m not sure how I’m gonna continue :S

It might be a very bad start though :$
Hope to find a help

  • 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-27T22:55:44+00:00Added an answer on May 27, 2026 at 10:55 pm

    First of all, you shouldn’t look at the average case since the upper bound of O(nk) can be proved for the worst case, which is a stronger statement.

    You should look at the maximum possible depth of recursion. In normal quicksort, the maximum depth is n. For each level, the total number of operations done is O(n), which gives O(n^2) total in the worst case.

    Here, it’s not hard to prove that the maximum possible depth is k (since one unique value will be removed at each level), which leads to O(nk) total.

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

Sidebar

Related Questions

I'm trying to solve this problem, its not a homework question, its just code
Disclaimer: This is for a homework assignment, but the question is not regarding the
This is not a homework question, just something at work that's bugging me. I'm
This is not a homework question, but rather my intention to know if this
Ok this is a homework questions, but I cannot find the answer anywhere, not
I'm stuck with this Java homework question: Write a new method, Refund, that simulates
This is a homework question,I'm trying to do a Depth-first search function in Scheme,Here's
This is a homework question. Frankly, I'm not sure how a C program delivers
This IS NOT a Homework question! While building my current student database project I
This is NOT a homework question, actually I am doing this for fun. Here

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.