-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinkedlistclient.java
More file actions
76 lines (69 loc) · 2.2 KB
/
linkedlistclient.java
File metadata and controls
76 lines (69 loc) · 2.2 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
package lec17_18;
public class linkedlistclient {
public static void main(String[] args) {
// linkedlist list = new linkedlist();
// list.insertfirst(1);
// list.insertfirst(2);
// list.insertfirst(3);
// list.insertfirst(34);
// list.insertfirst(7);
// list.insertlast(3);
// list.insertfirst(4);
// list.insertlast(5);
// list.insertlast(5);
// list.insertlast(5);
// System.out.println(list.deletefirst());
//// System.out.println(list.deletelast());
// list.display();
// System.out.println(list.getnode(2));
// System.out.println(list.getnode(1));
// list.insertinbetweeen(2,10);
// list.display();
// list.deleteinbetween(2);
// list.display();
//
// System.out.println("remobe duplicates are");
// list.removeduplicate();
// list.display();
// System.out.println("reverse is");
// list.reverse();
// list.display();
// System.out.println(list.vertex(2));
// linkedlist list1 = new linkedlist();
// linkedlist list2 = new linkedlist();
// list1.insertlast(1);
// list1.insertlast(2);
// list1.insertlast(3);
// list2.insertlast(4);
// list2.insertlast(5);
// list2.insertlast(6);
// linkedlist list3 = new linkedlist();
// list3=list3.merge(list1,list2);
//
// System.out.println("merge of teo linked list");
// list3.display();
//
// System.out.println("mid is");
// System.out.println(list.mid());
linkedlist list4 = new linkedlist();
list4.insertlast(10);
list4.insertlast(8);
list4.insertlast(3);
list4.insertlast(4);
list4.insertlast(6);
list4.insertlast(7);
// System.out.println("merge sort is");
// list4=list4.mergesort(list4);
// list4.display();
System.out.println("kth from last");
System.out.println( list4.kth(2));
// System.out.println(" separsste odd even");
// list4=list4.oddeven(list4);
// list4.display();
//
// System.out.println("separete second");
//
// list4.oddeven2();
// list4.display();
}
}