Professional Documents
Culture Documents
Machine addresses
3FA71CF6
Areferenceisadataitemthat
containsanaddress
3FA71CF6
Chaspointers,butJavahas
references
Sowhatsthedifference?
:
3FA71CF2
3FA71CF3
3FA71CF4
3FA71CF5
3FA71CF6
3FA71CF7
3FA71CF8
3FA71CF9
3FA71CFA
3FA71CFB
3FA71CFC
3FA71CFD
3FA71CFE
3FA71CFF
3FA71D00
3FA71D01
References
Data structures
Basically, pointers and references are the same thing; they point
to (refer to) something else in memory
A Data Structure is a description of how data is organized in
memory
Many (not all) data structures are built from objects pointing/referring to
one another
Understanding pointers (references) is fundamental to this course
In real life, its stupid to redo work thats already been done for you
A trivial example
class Person {
String name;
Person spouse;
Person (String n) {
name = n;
}
}
"John"
john
name
spouse
"Mary"
mary
name
spouse
12
null
null
7
null
null
4
null
null
Abinarytreerepresentingthe
arithmeticexpression12/4+7
}
To make binary trees as useful as possible, we make the value in
a node an Object
As implementers of the BinaryTree class, our job is to make sure
that the structure of the binary tree is always valid
We dont really care what the user puts in the value field
Size of objects
v1
v2
A reference to a Vector is
actually a reference to a
reference to a Vector
v1
v2
The End