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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:55:31+00:00 2026-06-18T11:55:31+00:00

Does anyone know of a data structure where I can access and delete the

  • 0

Does anyone know of a data structure where I can access and delete the k-th item in worst case O(logn) and also supports the operation of inserting an item after the k-th item in worst case O(logn)?

  • 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-18T11:55:32+00:00Added an answer on June 18, 2026 at 11:55 am

    Yes. What you describe can be achieved with an augmented tree. Every node has a counter indicating the number of nodes in its subtree (including itself). For leaf nodes, the counter is 1. For the root node, the counter is the total number of nodes. This way, you can find the k-th item with a binary search starting at the root. Whenever you insert/remove an element, you have to update the counters in the path that goes from that position to the root.

    This kind of trees have been called order statistic trees, rank trees, counter trees…

    You can find an implementation here and another one here.

    See chapter 14, “Augmenting Data Structures” in the great book “Intorduction to Algorithms”, by Cormen, Leiserson, Rivest and Stein.

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

Sidebar

Related Questions

Does anyone know where can I find recent data on PHP4 vs PHP5 market
Does anyone know of an algorithm or data structure relating to selecting items, with
Does anyone know if the data type DateTimeOffset is supported in the .NET Compact
Does anyone know how to prepare data to plot a CDF (I have a
Does anyone know how to pass html attributes like data-date to the Html.TextBox()?? It
I have a directed-graph, each node is a complex data type. Does anyone know
Does anyone know of any websites, or (preferably) downloadable packages that you can use
The question is does anyone know what the structure of the (type-2) plist files
Hi does anyone know where I can find a table which shows the Big
Does anyone know if the SAP LDAP connector can be used to modify the

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.