The Artima Developer Community
Sponsored Link

Java Buzz Forum
Find the root node of a tree from any node in the Java Tree

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
T Tak

Posts: 152
Nickname: awsometak
Registered: Feb, 2016

T Tak is Java Enthusiast
Find the root node of a tree from any node in the Java Tree Posted: Feb 6, 2016 3:35 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by T Tak.
Original Post: Find the root node of a tree from any node in the Java Tree
Feed Title: programtalk
Feed URL: http://programtalk.com/feed/
Feed Description: A blog mainly about java
Latest Java Buzz Posts
Latest Java Buzz Posts by T Tak
Latest Posts From programtalk

Advertisement
In this tutorial we will see how a traversal to the root node can be achieved from any node in a java tree. In the below tree we can reach the root from any Node. The traversal is  achieved by a adding a simple method to each node.It is very concise. public Node getRoot() { if(parent == null){ return this; } return parent.getRoot(); } So how does magical function work. Every node

Read: Find the root node of a tree from any node in the Java Tree

Topic: The battle for Node.js security has only begun Previous Topic   Next Topic Topic: Turns out machine learning is a champ at fixing buggy code

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use