Download presentation
Presentation is loading. Please wait.
1
Linked Lists Visual Basic 6.0
2
ADTs Data abstraction asks:
what you can do to a collection of data …apart from how you do it. Ex: Pop Machine Insert Money – Push button Expect what? What does ADT stand for? Do you really care how the machine works? No you just want your soda!
3
What is a node? Mathematics Definition: The point at which a continuous curve crosses itself. Astronomy Definition: Either of two points at which the orbit of a satellite intersects the orbital plane of a planet Others? Ask students what the two questions they would have to ask would be if they were to create a CNode class?
4
Our Definition… Node: a object which stores information and links to other nodes What it looks like:
5
What Nodes “Have” Data part “Pointer” part
Disclaimer: “Pointers” truly do not exist in Visual Basic. They are actually called references (which “refer” to memory locations) However, for the sake visually representing a linked list, it is easier to “refer” to a reference as a pointer. Got it? If not, I will provide more “reference” material! Ugh! : )
6
What Nodes “Do” Store Data Show Data “Link to” other nodes
Tell who they are “linked to”
7
The Node Black Box View Data (let property) Data (get property)
NextNode (let property) Refer back to black box created for fraction program NextNode (get property)
8
The Node Open Black Box Self referential declaration (Node) myNext
(Integer) myData Data (let property) Data (get property) NextNode (let property) ***Self referential declaration – reference to a variable of its own kind Why can we get away with this ?? Because its just a reference not an actual object NextNode (get property)
9
Work Time on Nodes Group Work in worksheets. Link nodes together.
Node reference that traverses the list Why is this better than the array? One way street.
10
We are going to the store…
What do we need? Well before we go to the store we need to make a list…
11
Shopping List… What do we need from the store? Milk Eggs Butter Apples
Bread Others? Why not an array? Contiguous memory allocation.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.