Home > other >  HashMap why not B tree to replace the red-black tree
HashMap why not B tree to replace the red-black tree

Time:09-15


Jdk1.8 HashMap is converted to a red and black tree is introduced, in the HashMap why not B + tree to replace the red and black tree?

CodePudding user response:

With q have the answer

CodePudding user response:

B + tree was applied in the database is more "squat" B + tree than B, B + tree of leaf nodes are not stored data, so each node can store more keywords, so B + tree more able to cope with a large number of data,
HashMap is originally an array of jdk1.7 + list, in the form of list because of its characteristics, search slowly so you need to find efficient tree structure to replace,
If using B + tree, in the case of data quantity is not many, the data will be "in" a node, this time traversal efficiency is degenerated into list,
  • Related