mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-25 05:22:39 +08:00
Fixed Error:(6, 8) java: class algorithm is public, should be declared in a file named algorithm.java. Inside file PrimeFactorization, the name of public class was wrong.
This commit is contained in:
@ -86,9 +86,12 @@ public class DoublyLinkedList {
|
||||
public Link deleteHead() {
|
||||
Link temp = head;
|
||||
head = head.next; // oldHead <--> 2ndElement(head)
|
||||
head.previous = null; // oldHead --> 2ndElement(head) nothing pointing at old head so will be removed
|
||||
if (head == null)
|
||||
|
||||
if (head == null) {
|
||||
tail = null;
|
||||
} else {
|
||||
head.previous = null; // oldHead --> 2ndElement(head) nothing pointing at old head so will be removed
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
@ -100,10 +103,13 @@ public class DoublyLinkedList {
|
||||
public Link deleteTail() {
|
||||
Link temp = tail;
|
||||
tail = tail.previous; // 2ndLast(tail) <--> oldTail --> null
|
||||
tail.next = null; // 2ndLast(tail) --> null
|
||||
|
||||
if (tail == null) {
|
||||
head = null;
|
||||
} else{
|
||||
tail.next = null; // 2ndLast(tail) --> null
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user