Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
306
306Ass4
Commits
2e318113
Commit
2e318113
authored
Feb 24, 2019
by
michael lundquist
Browse files
Adding these files to the package
parent
151ab5c7
Pipeline
#3978
failed with stage
in 1 minute and 23 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
fourthassignment/src/main/java/com/ds/fourthassignment/CircularLinkedList.java
View file @
2e318113
package
com.ds.fourthassignment
;
public
class
CircularLinkedList
{
private
LNode
head
;
private
LNode
tail
;
private
int
size
;
public
CircularLinkedList
(){
head
=
null
;
tail
=
null
;
size
=
0
;
}
public
void
addToHead
(
LNode
newNode
){
//adding to head:
if
(
head
==
null
){
head
=
newNode
;
tail
=
head
;
}
else
{
//update head
newNode
.
setNext
(
head
);
tail
.
setNext
(
newNode
);
head
=
newNode
;
}
size
++;
}
public
void
addToTail
(
LNode
newNode
){
if
(
tail
==
null
){
tail
=
newNode
;
head
=
tail
;
}
else
{
//update tail
tail
.
setNext
(
newNode
);
newNode
.
setNext
(
head
);
tail
=
newNode
;
}
size
++;
}
public
String
display
(){
String
out
=
""
;
if
(
head
==
null
)
return
null
;
LNode
current
=
head
;
do
{
out
+=
current
.
getData
()
+
","
;
if
(
current
==
tail
)
break
;
current
=
current
.
getNext
();
}
while
(
current
!=
null
);
return
out
;
}
public
boolean
isEmpty
(){
return
(
head
==
null
?
true
:
false
);
}
public
int
getSize
()
{
return
size
;
}
}
\ No newline at end of file
fourthassignment/src/main/java/com/ds/fourthassignment/DoublyLNode.java
View file @
2e318113
package
com.ds.fourthassignment
;
public
class
DoublyLNode
{
private
String
data
;
...
...
fourthassignment/src/main/java/com/ds/fourthassignment/DoublyLinkedList.java
View file @
2e318113
package
com.ds.fourthassignment
;
public
class
DoublyLinkedList
{
private
DoublyLNode
head
;
...
...
fourthassignment/src/main/java/com/ds/fourthassignment/LNode.java
View file @
2e318113
package
com.ds.fourthassignment
;
public
class
LNode
{
Integer
data
;
...
...
fourthassignment/src/main/java/com/ds/fourthassignment/TNode.java
View file @
2e318113
package
com.ds.fourthassignment
;
public
class
TNode
{
private
Scientist
data
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment