Current position: Home > Default > How to find a shortest distance in a tree from one node to another node
How to find a shortest distance in a tree from one node to another node
my question is same as above.. there are many algorithms which i had come across but they are mainly for graphs or weighted trees. i want to traverse through a binary tree... how is it possible.. any link to the solution or source code sample will work...
Thanks
redfalconf35 wrote:
[http://en.wikipedia.org/wiki/Tree_traversalhttp://en.wikipedia.org/wiki/Tree_traversal]
that is good link. but . given a node is it possible for me to find all is ancestors or parents so that i can traverse up the hierarchy.....Most simple tree implementations just have references from each node to its children. You either want:
1. the tree data structure to maintain back pointers  from each child back to its parent, OR
2. a bread crumb trail: as you traverse the tree or otherwise pick a node, you need to have built a list of references from the root down to the node in question.
 Read related articles
 Shortest distance between two line segments
 How to draw a line(shortest distance) between two ellipse using SWING
 Maps  Change Settings from shortest distance to shortest time
 How to Determine the Shortest Distance
 Finding the shortest path router for the router tracking purpose
 Measuring distance between points
 Is 5x minimum focus distance covering all distances?
 Imaq point distances
 NG 7 Billion  How'd they do that?
 Need help for Java Programming asap plzzzzzzzzzzzzz
 Can't fine tune scene icon starting point
 Oracle Locator  Implementation
 Area of the parts != Area of the whole
 Can you choose a different route in maps?
 Array index problem in formula node
 Converting multiple points to line
 Anyone noticed Safari scrolling too fast (Magic Mouse)?
 Result of sdo_within_distance
 Partitioning went wront, lost 32GB on my HDD

Shortest distance between two line segments
00011130Hi. I am looking for the code of the "Shortest distance between two line segments". I would appreciate if anyone has and willing to share. I can find some in the net but its in VB and i am not familiar with it. THanks a lot. regards,There are a

How to draw a line(shortest distance) between two ellipse using SWING
00011130how to draw a line(should be shortest distance) between two ellipse using SWING any help will be appreciated regardsimport java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; import javax.swing.event.MouseInputAdapter;

Maps  Change Settings from shortest distance to shortest time
00011130It appears that the MAPS always give a route in the shortest distance. Is it possible to get the route in shortest time?Mark: thanks....! Not what I wanted to hear but at least I know to use my Garmin or Sync maps instead.Read other 3 answers

How to Determine the Shortest Distance
00011130It's been a while since I last pestered the group, but I'm back with a new problem. This one is not so much one I can't solve, but one that I can't solve gracefully. At times, doctors will leave our organization and that doctor's patients must be han

Finding the shortest path router for the router tracking purpose
20151011Hi all, A Question asking you regarding to routers' tracking information. We keeps all the router infomation of our subnet in a file name "routers.txt" in this format: 1 2 1 2 4 1 4 3 1 1 3 5 This states there are four routers, the distance betw

Measuring distance between points
00011130Hey, I am trying to do 2D particle tracking. What I am trying to do is for each point in the image, I want to find the shortest distance to anouther point. Repeat for each point. Then move on to the next image and then compare those distances, sin

Is 5x minimum focus distance covering all distances?
00011130In the Shooting Guide three distances are recommended: 1 x minimum focus distance (32 cm) 2 x minimum focus distance (64 cm) 5 x minimum focus distance (160 cm) I have added the actual distances for my 2470 mm setup. In the lensprofile these distan

Imaq point distances
00011130I want to be able to trace a line on top of an image and using the IMAQ point distances tool determine de length in pixels of the line. I am having trouble converting the xy coordinates from the ROI tool to the right format input for the IMAQ point d

NG 7 Billion  How'd they do that?
00011130Curious if anyone knows how National Geographic achieved launching the ipad email browser filled in with HTML body content directly from their digital magazine? At the beginning of each article, there is an email icon displayed, and when you click on

Need help for Java Programming asap plzzzzzzzzzzzzz
00011130Here is the work: (Im writing it coz I wasn't able to attach it) Introduction In geometry, a straight line is the shortest distance between two points. A line may be characterised by its end points and its length. A line connects the points P1 and P2

Can't fine tune scene icon starting point
00011130Hello. I have an iMovie HD project that I am finalizing in iDVD 6. It is 90 minutes long and divided into ten chapters. iDVD 6 automatically created motion icons for each of the ten chapters. For ease of editing, I have turned Motion off for now. I c

Oracle Locator  Implementation
00011130I have a need to calculate shortest distance between any two locations (addresses) using Oracle Locator. The only parameters that are available to me as inputs are the 5 digit zip code, latitude and longitude of the location. I am looking for help in

Area of the parts != Area of the whole
00011130My tables are polygon datasets stored in NAD83 (SRID=8265) and I have noticed that the sum of area calculations of a subdivided polygon do not equal the area of the original polygon. I created a simple test case to confirm the results. I created a sq

Can you choose a different route in maps?
00011130I searched for directions in the maps app and it shows me a route that is way out of the way and is 16 hours compared to mapquest telling me 12 hours and a more direct route. I know that online at google maps you can choose from several route options

Array index problem in formula node
00011130dear friend I'm trying to use formula node to solve a problem because I make this program using c at the begining. It runs perfectly in turbo c, but somehow it doesn't work in the formula node. I try to debug my source code, and I find that the formu

Converting multiple points to line
00011130Hi All I have table consist of point data.. how to convert multiple points to line data.. if anyknows pls tell me .. Thak youuser13340372, . . . .Are you trying to draw a line between 2 points or draw a line connecting N points? How to Create a Line

Anyone noticed Safari scrolling too fast (Magic Mouse)?
00011130Has anyone reading this noticed that scrolling with a Magic Mouse, while in Finder, other Apps (or Browsers such as Chrome and FF) is commensurate with the Scroll settings set in System Preferences \ Mouse \ Scrolling, but that in Safari, those setti

Result of sdo_within_distance
00011130Hello everyone, I use following select to get the shortest distance from a point to different geometry objects in a table: SELECT /*+ ORDERED INDEX( p SK_2006_SPA_SX */ sdo_geom.sdo_distance(p.geom, center.geom, 0.5, 'unit=METER') distanceToReference

Partitioning went wront, lost 32GB on my HDD
00011130Hi, Today I tried using Boot Camp assistent to partition my HDD on my iMac. During this process I got a Kernel Panic. The partitioning went wrong, and now I lost 32GB of my HDD space. Any idea how I can get it back? In Boot Camp assistent I can't rec
Hots
 1TS2755 Ever since I updated my iphone 4 to 5.1.1, I am not able to send more than one picture at a time in a text message. Does anyone know how to fix this? 1011
 2I cannot open/download Word documents. I need to add it to applications, but the "open as" box does not pop up when I click on a link. How can I add Word to applications? 1011
 3HT203671 What if I use a screen protector together with the keyboard top case? 1130
 4Im in the caribbean and we speak english but netflix shows everything in spanish or some other foreign language and im clueless about how to get it to show in english 1130
 5Is Illustrator CC's Smart Guides Intersect label MIA? 1130
 6Audio Links Broken in IE 1130
 7Order Entry Schema for 10G Express Edition 1130
 8Pa custom infptype and org management infotype creation 1130
 9MIDI not working! Help! 1130
News
 ClassNotFoundException while invoking jaxws client from OIM 10g10/11
 Using iMac 27 as a display for a PC, is it possible?10/11
 Dynamic actions in tabular forms10/11
 Weblogic Server training10/11
 Underlined labels in forms11/30
 PNG files?11/30
 High resolution graphics11/30
 UCCX CAD authentication issue when pub is down11/30
 Failed to load book because the requested resource is missing11/30
 HELP! iPhoto 2 when I click on an album, it erases my pics!11/30