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

Time:November 30
Advertisement
Hi
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
Advertisement
Rastogha wrote:
redfalconf35 wrote:
[http://en.wikipedia.org/wiki/Tree_traversal|http://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.

Shortest distance between two line segments

-0001-11-30

Hi. 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

-0001-11-30

how 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

-0001-11-30

It 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

-0001-11-30

It'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

2015-10-11

Hi 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

-0001-11-30

Hey, I am trying to do 2-D 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?

-0001-11-30

In 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 24-70 mm set-up. In the lensprofile these distan

Imaq point distances

-0001-11-30

I 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?

-0001-11-30

Curious 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

-0001-11-30

Here 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

-0001-11-30

Hello. 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

-0001-11-30

I 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

-0001-11-30

My 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?

-0001-11-30

I 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

-0001-11-30

dear 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

-0001-11-30

Hi 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)?

-0001-11-30

Has 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

-0001-11-30

Hello 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

-0001-11-30

Hi, 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