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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:14:51+00:00 2026-05-28T07:14:51+00:00

Tries are very fast data structures. Looking up a word takes O(sizeofword) time, while

  • 0

Tries are very fast data structures. Looking up a word takes O(sizeofword) time, while std::maps are self-balacing trees. Why aren’t the standard C++ map templates implemented with tries. Is there any specific reason? Are there any tradeoffs of using a trie instead of a self-balancing tree?

  • 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-28T07:14:52+00:00Added an answer on May 28, 2026 at 7:14 am

    Tries can only be used when the keys to be stored can be processed digit by digit or character by character. The C++ std::map and std::set are designed to work with any comparable elements as keys, and thus can’t be implemented in a way that processes the keys character by character. They instead (typically) use balanced binary search trees, which don’t need to introspect on the keys and can instead just use a comparator to do fast lookups.

    If you know for sure that certain properties hold for your keys, you can in some cases do even better than tries (see the van Emde Boas tree for an example). However, library designers have to design for a lot of use cases and thus may need to pick options that are slower than the absolutely best option because they need to handle the largest possible number of options.

    Additionally, it’s actually perfectly possible that a conforming C++ implementation contain a specialization of std::map or std::set that uses a trie when the keys are strings. I don’t believe that any do, but it is in theory possible.

    Hope this helps!

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

Sidebar

Related Questions

NSURLConnectionDelegate surely reduces the memory consumption and helps to parse the data very fast.
I am very interested in streaming data for web-applications. I have tried out some
I'm studying the best data structures to implement a simple open-source object temporal database,
I have a very fast loop which renders animation in a Bitmap buffer and
.NET 4.0 I am looking for the easiest way to generate a Word document
We were just assigned a new project in my data structures class -- Generating
I need a persistent storage in Java for certain (possibly large) data structures, such
I have a recursive query which executes very fast if the WHERE clause contains
I have a simple question that I think someone will answer very fast, but
In our application we use std::map to store (key, value) data and use serialization

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.