Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

📚 The CoCalc Library - books, templates and other resources

132930 views
License: OTHER
1
public class Main {
2
public static void main(String[] args) {
3
SinglyLinkedList list = new SinglyLinkedList();
4
list.printList();
5
6
// append new elements at the front of the list
7
list.append(12);
8
list.printList();
9
list.append(13);
10
list.printList();
11
list.append(14);
12
list.printList();
13
list.append(15);
14
list.printList();
15
16
// remove elements
17
list.remove(13);
18
list.printList();
19
20
// find elements
21
int numberA = list.find(14);
22
int numberB = list.find(13);
23
System.out.println(numberA + " " + numberB);
24
}
25
}
26
27
28