@@ -17,7 +17,7 @@ public class SortedLinkedList {
17
17
private Node head ;
18
18
private Node tail ;
19
19
20
- public SortedLinkedList (){
20
+ public SortedLinkedList () {
21
21
this .head =null ;
22
22
this .tail =null ;
23
23
}
@@ -27,7 +27,7 @@ public SortedLinkedList(){
27
27
*
28
28
* @param value the value to be inserted
29
29
*/
30
- public void insert (int value ){
30
+ public void insert (int value ) {
31
31
Node newNode = new Node (value );
32
32
if (head == null ) {
33
33
this .head = newNode ;
@@ -53,7 +53,7 @@ else if (value > tail.value) {
53
53
/**
54
54
* Displays the elements of the sorted linked list.
55
55
*/
56
- public void display (){
56
+ public void display () {
57
57
System .out .println (this .toString ());
58
58
}
59
59
@@ -63,7 +63,7 @@ public void display(){
63
63
* @param value the value to be deleted
64
64
* @return true if the element is found and deleted, false otherwise
65
65
*/
66
- public boolean delete (int value ){
66
+ public boolean delete (int value ) {
67
67
if (this .head == null ) {
68
68
return false ;
69
69
}
@@ -91,7 +91,7 @@ else if (this.head.value == value) {
91
91
* @param value the value to be searched
92
92
* @return true if the element is found, false otherwise
93
93
*/
94
- public boolean search (int value ){
94
+ public boolean search (int value ) {
95
95
Node temp = this .head ;
96
96
while (temp != null ) {
97
97
if (temp .value == value ) {
@@ -116,7 +116,7 @@ public boolean isEmpty() {
116
116
*
117
117
* @return the minimum value
118
118
*/
119
- public int minValue (){
119
+ public int minValue () {
120
120
return this .head .value ;
121
121
}
122
122
@@ -125,7 +125,7 @@ public int minValue(){
125
125
*
126
126
* @return the maximum value
127
127
*/
128
- public int maxValue (){
128
+ public int maxValue () {
129
129
return this .tail .value ;
130
130
}
131
131
@@ -150,12 +150,12 @@ public class Node {
150
150
public int value ;
151
151
public Node next ;
152
152
153
- public Node (){
153
+ public Node () {
154
154
this .value = 0 ;
155
155
this .next = null ;
156
156
}
157
157
158
- public Node (int value ){
158
+ public Node (int value ) {
159
159
this .value = value ;
160
160
this .next = null ;
161
161
}
0 commit comments