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

The Archive Base Latest Questions

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

Apparently you could do either, but the former is more common. Why would you

  • 0

Apparently you could do either, but the former is more common.

Why would you choose the latter and how does it work?

I read this: http://www.drdobbs.com/cpp/stls-red-black-trees/184410531; which made me think that they did it. It says:

insert_always is a status variable that tells rb_tree whether multiple instances of the same key value are allowed. This variable is set by the constructor and is used by the STL to distinguish between set and multiset and between map and multimap. set and map can only have one occurrence of a particular key, whereas multiset and multimap can have multiple occurrences.

Although now i think it doesnt necessarily mean that. They might still be using containers.

I’m thinking all the nodes with the same key would have to be in a row, because you either have to store all nodes with the same key on the right side or the left side. So if you store equal nodes to the right and insert 1000 1s and one 2, you’d basically have a linked list, which would ruin the properties of the red black tree.

Is the reason why i can’t find much on it that it’s just a bad idea?

  • 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-12T01:03:38+00:00Added an answer on June 12, 2026 at 1:03 am

    down side of store as multiple nodes:

    1. expands tree size, which make search slower.

    2. if you want to retrieve all values for key K, you need M*log(N) time, where N is number of total nodes, M is number of values for key K, unless you introduce extra code (which complicates the data structure) to implement linked list for these values. (if storing collection, time complexity only take log(N), and it’s simple to implement)

    3. more costly to delete. with multi-node method, you’ll need to remove node on every delete, but with collection-storage, you only need to remove node K when the last value of key K is deleted.

    Can’t think of any good side of multi-node method.

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

Sidebar

Related Questions

In managed C++/CLI, I could do this either as (1): array<System::Byte>^ css_keycode = {0x51,
I thought what I had was a common problem, but I could not find
Please could you explain this apparently inconsistent behaviour to me: use strict; my @a;
Apparently mutableCopy copies by reference, not value. Ie if I do this: NSMutableArray arrayA
This could be a challenging one! I'm very proficient in AJAX and JavaScript even
Okay; sorry I know this isn't a programming question as such, but it was
I have an application server (JBoss, but this also happens in Tomcat) running as
I'm writing a program that uses java.net.URLDecoder.decode(String value, String encoding) . Apparently, this method
Apparently MapReduce queries are one of the slowest things one can do in MongoDB
Apparently when linking a library build with the Intel Composer 12.1 or against 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.