Solved

TreeMap

Posted on 2011-09-07
2
276 Views
Last Modified: 2012-05-12
i would liek to know about TreeMap .

I read TreeMap

 based on the Red-Black tree data structure.


I a=was not clear on that. When, how , where we use it and we implememnt it.

Thanks in advance
0
Comment
Question by:gudii9
2 Comments
 
LVL 47

Accepted Solution

by:
for_yan earned 250 total points
ID: 36495763

http://www.jguru.com/faq/view.jsp?EID=981


Answer
A red-black tree is a binary search tree where every node has two children or is a leaf. It ensures O(log N) search times, at a cost of a more complicated insertion (and deletion) process. In a red-black tree, every node is colored either red or black, with a black root node, though a black root node isn't a requirement. In addition, if a node is red, its children must be black and every path from root to leaf (or null child node) must contain the same number of black nodes. These rather obscure rules ensure the tree is balanced.


0
 
LVL 7

Assisted Solution

by:rumi78
rumi78 earned 250 total points
ID: 36498238
TreeMap is Map implementation.

You use it when you want to have values ordered by key.

It means, when you iteratate map.values() it will be ordered.

rgds
rumi
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to implement Singleton Design Pattern in Java.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now