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

  • Home
  • SEARCH
  • 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 3617452
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:37:35+00:00 2026-05-18T22:37:35+00:00

Well, this question is a bit specific but I think there is some general

  • 0

Well, this question is a bit specific but I think there is some general idea in it that I can’t get it.

Lets say I got K servers (which is a constant that I know its size). I have a program that get requests and every request has an id and server id that will handle it. I have n requests – unknown size and can be any number.

I need a data structure to support the next operations within the given complexity:

GetServer – the function gets the request ID and returns the server id that is supposed to handle this request at the current situation and not necessarily the original server (see below).

Complexity: O(log K) at average.

KillServer – the function gets as input a server id that should be removed and another server id that all the requests of the removed server should be passed to.

Complexity: O(1) at the worst case.

—

Place complexity for all the structure is O(K+n)

—

The KillServer function made me think using a Union-Find as I can do the union in O(1) as requested but my problem is the first operation. Why it’s LogK? Actually, no matter how I “save” the requests if I want to access to any request (lets say it’s an AVL tree) so the complexity will be O(log n) at the worst case and said that I can’t assume K>n (and probably K

Tried thinking about it a couple of hours but I can’t find any solution.
Known structures that can be used are: B+ tree, AVL tree, skip list, hash table, Union-Find, rank tree and of course all the basics like arrays and such.

  • 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-18T22:37:35+00:00Added an answer on May 18, 2026 at 10:37 pm

    Union-find starting with requests partitioned by server should work. You start with each request pointing to it’s server, then you union together the servers (not the requests). Thus, the amortized cost of GetServer would be O(alpha(K)) rather than O(alpha(n)), where O(alpha(K)) << O(log K).

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

Sidebar

Related Questions

Ok another WPF question, well I guess this is just general .NET. I have
this is my first question here so I hope I can articulate it well
This is a bit embarrassing scenario but I need solution. I am using some
This question would probably apply equally as well to other languages with C-like multi-line
A Java version of this question was just answered, and, well, I don't know
I have two tables (well, two relevant for this question) : Bets (holds the
I hope this question is not considered too basic for this forum, but we'll
Well this is incredibly frustrating. After being nagged by Rails that I need to
Well I have this MySQL stored procedure that I wrote and if I run
I am using Delphi TApplication.OnException Event to catch unhandled exceptions This works well but

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.