I about data structures (trees) in java

Click For Summary
SUMMARY

The discussion focuses on creating and manipulating tree data structures in Java. The user seeks guidance on whether a built-in "Tree" object exists in Java for easy manipulation, such as adding nodes with methods like addNode() and retrieving data with getData(). Participants clarify that Java does not provide a native tree class, suggesting the implementation of custom tree structures or the use of libraries like Java Collections Framework for tree-like structures.

PREREQUISITES
  • Understanding of Java programming language
  • Familiarity with object-oriented programming concepts
  • Knowledge of data structures, specifically trees
  • Experience with Java Collections Framework
NEXT STEPS
  • Implement a custom tree class in Java
  • Explore Java Collections Framework for tree-like data structures
  • Research tree traversal algorithms (e.g., in-order, pre-order, post-order)
  • Learn about balancing trees, such as AVL trees or Red-Black trees
USEFUL FOR

Java developers, computer science students, and software engineers interested in data structures and algorithms, particularly those focusing on tree implementations and manipulations.

JoAuSc
Messages
197
Reaction score
1
I'm trying to create this program that allows the user to create and manipulate trees. For example, a user might create a new tree with a node containing "words" as its data, then create nodes containing "nouns", "verbs", "adjectives", etc. as their data. The problem is I don't know how to create or work with trees. Is there some kind of "Tree" object in java, where I can just write

Tree newTree = new Tree();

and manipulate the tree with methods like

newTree.addNode("nouns");

or

newString = newTree.node1.getData()

?

And if not, how would I work with trees?
 
Technology news on Phys.org
If you don't know how to work with trees, then why do you think you need one? What are you actually trying to do?
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
4K
Replies
86
Views
3K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 13 ·
Replies
13
Views
5K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 10 ·
Replies
10
Views
2K