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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:41:14+00:00 2026-05-27T00:41:14+00:00

Why one languages uses tree and another uses hash table for seemingly similar data

  • 0

Why one languages uses tree and another uses hash table for seemingly similar data structure?

c++’s map vs python’s dict

A related question is about performance of hash table.
Please comment on my understanding of hash table below.

A tree is guaranteed to have O(log n).
Whereas hash table has no guarantee unless inputs are previously known because of possible collisions.
I tend to think hash table’s performance would become close to O(n) as problem size gets bigger.
Because I haven’t heard of a hash function that dynamically adjust its table size as problem size grows.

Hence, hash table is only useful for certain range of problem size, and that’s why most DB uses tree than hash table.

  • 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-27T00:41:14+00:00Added an answer on May 27, 2026 at 12:41 am

    The new C++ standard has the std::unordered_map type which is a hash table. IIRC they wanted it to get into the previous standard as well, but there was not enough time during the discussions so it was left out. However, most popular compilers provided it in one way or another for years.

    In other words, don’t worry about it too much. Use the proper data structure for the task at hand.


    As for your understanding of hash tables, it’s inaccurate:

    I haven’t heard of a hash function that dynamically adjust its table
    size as problem size grows

    All serious hash table implementation dynamically adjust themselves for growing input, by allocating a larger array and re-hashing all the keys. Although this operation is expensive, if designed properly (to be done rarely enough) the performance is still amortized O(1).

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

Sidebar

Related Questions

Another question on SO brought up the facilities in some languages to hash strings
I want to display content in more than one languages in a page. For
Well as I have posted earlier too...I have created a site in two languages.One
I have a multilingual ASP.NET site; one of the languages is Arabic (ar-SA). To
One of the huge benefits in languages that have some sort of reflection/introspecition is
When one creates web content in languages different than English the problem of search
One of the best classes I took in college was Programming Languages where the
Java is one of my programming languages of choice. I always run into the
I moved one years ago from classic OO languages such like Java to JavaScript.
In an RPG program (One of IBM's languages on the AS/400) I can chain

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.