-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFibonacciNode.java
More file actions
78 lines (74 loc) · 1.92 KB
/
FibonacciNode.java
File metadata and controls
78 lines (74 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* FibonacciNode class.
*
* @author Alisha Sprinkle (primarily)
* @author Courtney Dixon (checkstyle)
* @version 11/9/2019
*/
public class FibonacciNode {
FibonacciNode parent;
FibonacciNode child;
FibonacciNode left;
FibonacciNode right;
int key;
int degree;
boolean marked;
/**
* No-arg Constructor.
* Sets all values to null.
* Initially a node will be marked as false
*/
public FibonacciNode() {
parent = null;
child = null;
left = null;
right = null;
key = 0;
degree = 0;
marked = false;
}
/**
* One-arg Constructor.
* Helps in cases where we need to create a new node with specific key
* @param key FibonacciNodes key
*/
public FibonacciNode(int key) {
parent = this;
child = this;
left = this;
right = this;
this.degree = 0;
this.key = key;
this.marked = false;
}
/**
* Seven-arg Constructor.
* Helps if we need to create a node with all values
* @param parent FibonacciNode's parent
* @param child FibonacciNode's child
* @param left FibonacciNode to FibonacciNode's left
* @param right FibonacciNode to FibonacciNode's right
* @param key FibonacciNode's key
* @param degree FibonacciNode's degree
* @param marked FibonacciNode's mark
*
*/
public FibonacciNode(FibonacciNode parent, FibonacciNode child,
FibonacciNode left, FibonacciNode right,
int key, int degree, boolean marked) {
this.parent = parent;
this.child = child;
this.left = left;
this.right = right;
this.key = key;
this.degree = degree;
this.marked = marked;
}
/**
* Accessor method for key field.
* @return key key field
*/
public int getKey() {
return this.key;
}
}