M
Martin Mrazek
Hello,
can anybody advise how to represent a general tree data structure in
VB(A)? (In Pascal o C it would be typical type of problem solved by
pointers). For example I have something like the following:
Elements of data structure: a1, a2, a3, ..., aENDm (value of ENDm is
arbitrary).
Properties of each element:
P1. Each element has one double value
P2. Each element has zero, one or two successors
P3. Each element, except the first one, has just one predecessor
P4. Each element can show to its successors – on the "Sample of data
structure" bellow: a5.successor(1) = a8, a5.successor(2) = a7 etc.
It means if elements are considered as objects:
Object element
--------------
a5.value = 3.45 (type double)
a5.successor(1) = a8 (??type?? pointer)
a5.successor(2) = a7
....
a3.successor(1) = nothing
Sample of data structure
------------------------
a1 --> a2 --> a9 ... aEND1
|--> a3
|--> a4--> a5 --> a8 ... aEND2
.. | |--> a7 ... aEND3
.. . .
.. . .
.. . .
.. .
.. '--> aENDn
..
‘--> aENDm
Numbers END1, ..., ENDn,..., ENDm differs dramatically according to
user of my VB application (I emphasize that from user to user also the
number of structure ending elements (m in above example) differs).
I feel there should be some solution using OOP for that, but
unfortunately, I'm beginner in OOP. Can you advise, please?
Martin
can anybody advise how to represent a general tree data structure in
VB(A)? (In Pascal o C it would be typical type of problem solved by
pointers). For example I have something like the following:
Elements of data structure: a1, a2, a3, ..., aENDm (value of ENDm is
arbitrary).
Properties of each element:
P1. Each element has one double value
P2. Each element has zero, one or two successors
P3. Each element, except the first one, has just one predecessor
P4. Each element can show to its successors – on the "Sample of data
structure" bellow: a5.successor(1) = a8, a5.successor(2) = a7 etc.
It means if elements are considered as objects:
Object element
--------------
a5.value = 3.45 (type double)
a5.successor(1) = a8 (??type?? pointer)
a5.successor(2) = a7
....
a3.successor(1) = nothing
Sample of data structure
------------------------
a1 --> a2 --> a9 ... aEND1
|--> a3
|--> a4--> a5 --> a8 ... aEND2
.. | |--> a7 ... aEND3
.. . .
.. . .
.. . .
.. .
.. '--> aENDn
..
‘--> aENDm
Numbers END1, ..., ENDn,..., ENDm differs dramatically according to
user of my VB application (I emphasize that from user to user also the
number of structure ending elements (m in above example) differs).
I feel there should be some solution using OOP for that, but
unfortunately, I'm beginner in OOP. Can you advise, please?
Martin