tags:

views:

181

answers:

7
+3  Q: 

Help with English

I need to define an element from linkedList in a object:

    A
  /    \
X     Y

How could I name the entire object and its components in English?

à la: Hand-Body-Leg object named Body. or maybe somthing like queue kernel hand treeObject?

Ok, let's show you the example of a railway:

NodeStation => Station => Station => Station => NodeStation => Station => Station => NodeStation => ...

I need to have an object (NodeStationAndNeighbourdStations) with following 3 elements: NodeStation, LeftNeighbor, RightNeighbor in a more general manner.

A: 

I'm not sure what you mean (or even if this question is supposed to be on stackoverflow) but wouldn't you just call it the Tree, the left node and the right node ?

TimothyP
This is not a three, because have always 3 elements, A, X, Y
serhio
A: 
parent -> child

?

BioBuckyBall
see my edit in the question
serhio
+3  A: 
             Node                        Node
              |                            |
     ------ Parent ------              --- A ---  
     |                  |              |       | 
Left child         Right child         X       Y 

The whole object I'd call Node.

Leniel Macaferi
Say, A - parent, X, Y left rigth child, and the object?
serhio
this structure should have a name too...
serhio
The name is Node. You'd have: Node's parent, parent's left and right child.
Leniel Macaferi
yeah.. .something like this. .. see my edit in the question
serhio
Say, the parent is not really a parent, like in inheritance or WinForms... :) it's just the "main" node, and auxiliary nodes.
serhio
OK, can be the main node...
Leniel Macaferi
So, say... as real object names this could be `Node` containing: `Left`, `Right` and `Root`...
serhio
Yeah... I think this is a good option.
Leniel Macaferi
+1  A: 

Perhaps this is the kind of naming you mean - a node that consists of:

A - parent/head
X - left child/node
Y - right child/node
Oded
and the object itself?
serhio
A `Node` with `Parent`, `LeftChild` and `RightChild`? maybe... but as I said, this should not be linked to the list, anymore. So maybe not Node...
serhio
@serhio - A `Node` in the linked list then.
Oded
see my edit in the question
serhio
+1  A: 

Are X and Y children of A? That is what many will infer from your diagram. If instead A,X, and Y are merely strings then you have 3 fields that could be within some class name. The question is what are the slashes supposed to imply is where I think 99% of the problem is here.


Given the edits to the question, I'm thinking that the other ideas of this being a binary tree are correct where A, X, and Y are all Nodes of the tree, where A is the Root, with X as its Left Child, Y as its Right Child and the whole structure called a Binary Tree, assuming that there are only 2 children allowed per node. If there can be any number of children then this is a different structure. However, this isn't a Linked List to my mind in the traditional sense as usually a linked list is depicted in linear terms,e.g. A->X->Y so that each node is only pointing at one node, with the anomaly of a doubly-linked list being separate as usually a linked list is a singly-linked list to my mind.


I'm still confused by what that picture is supposed to imply. If someone is at A, do they see X and Y, while at X or Y they only see A? Are all three elements of a class and the diagram isn't useful as there isn't a point in displaying them this way? Would there be other elements that may contain X or Y as the parent node or is it that each node in the tree contains 3 elements like A,X,Y and there isn't any connection among the elements? This is a very confusing picture as this isn't looking like many other graph-like structures I've seen.


So, A is a NodeStation and each of X and Y are Stations. Thus, each is a separate element of the list? Perhaps a better way to display this would be

... => X <=> A <=> Y <=...

Though even that has some challenges to it, in terms of understanding what is and isn't implied.

JB King
see my edit in the question
serhio
as I already said in a comment this is not a three, because it contains always exactly 3 elements, no less or more. But the "Root" keyword for the main Node is a good choice.
serhio
"Would there be other elements that may contain X or Y". You complicate the things. I separate 3 and only 3, never less or more, so, 3 elements from a path. An element is a Station(X, Y) or a NodeStation(:Station, for A). By NodeStation, I mean a station that can acquire multiple trains, if you want.
serhio
A: 

Finally, the taken solution was

ListElement(Previous, Root, Following)
serhio
A: 

It's a link really. Like a link in a chain. Hence linked list.

DrJokepu
A link, before me, should *link* something. This is more about the order, or position of X and Y vs the A.
serhio