@@ -7,82 +7,25 @@ using namespace std;
7
7
int main () {
8
8
LinkedList<int > llist;
9
9
10
- // Default constructor
11
- cout << " --- Default constructor start---" << endl;
12
- llist.printAllNodes ();
13
- cout << " --- Default constructor start---" << endl;
14
- cout << " ##########" << endl;
15
- cout << " --- Print all nodes start ---" << endl;
16
- llist.printAllNodes ();
17
- cout << " ---Print all nodes end ---" << endl;
18
-
19
-
20
- cout << " ##########" << endl;
21
- cout << " --- Insert at the end accordingly [1, 7, 4, 444] start ---" << endl;
22
10
llist.insertAtTheEnd (1 );
23
11
llist.insertAtTheEnd (7 );
24
12
llist.insertAtTheEnd (4 );
25
13
llist.insertAtTheEnd (444 );
26
- cout << " --- Insert at the end accordingly [1, 7, 4, 444] end ---" << endl;
14
+ llist.insertAtTheFront (444 );
15
+ llist.insertAtTheFront (444 );
27
16
28
- cout << " ##########" << endl;
29
- cout << " --- Print all nodes start ---" << endl;
30
17
llist.printAllNodes ();
31
- cout << " ---Print all nodes end ---" << endl;
32
-
33
- cout << " ##########" << endl;
34
- cout << " --- Get number of nodes start ---" << endl;
35
- cout << llist.getNumberOfNodes ()<< endl;
36
- cout << " --- Get number of nodes end ---" << endl;
37
-
38
-
39
- cout << " ##########" << endl;
40
- cout << " --- print Reversed start ---" << endl;
41
- llist.printReversed ();
42
- cout << " --- print Reversed end ---" << endl;
43
18
44
19
45
- cout << " ##########" << endl;
46
- cout << " --- copy constructor start ---" << endl;
47
- LinkedList<int > newList (llist);
48
- cout << " ---- created newList deep copying llist start ----" << endl;
49
- newList.printAllNodes ();
50
- cout << " ---- created newList deep copying llist endl ----" << endl;
51
- cout << " ---- Print all nodes of llist start ----" << endl;
52
- llist.printAllNodes ();
53
- cout << " ---Print all nodes of llist end ---" << endl;
54
- cout << " ---- changing llist and newList each ---" << endl;
55
- llist.insertAtTheFront (6554 );
56
- newList.insertAtTheEnd (6677 );
57
- cout << " ---- changed newList start ----" << endl;
58
- newList.printAllNodes ();
59
- cout << " ---- created newList endl ----" << endl;
60
- cout << " ---- llist start ----" << endl;
61
- llist.printAllNodes ();
62
- cout << " ---- llist end ---" << endl;
63
- cout << " --- copy constructor end ---" << endl;
64
-
65
- cout << " ##########" << endl;
66
- cout << " --- Remove node with data 4 from llist start ---" << endl;
67
- llist.removeNode (llist.findNode (4 ));
68
- llist.printAllNodes ();
69
- cout << " --- Remove node with data 4 from llist end ---" << endl;
20
+ // LinkedList<int> newList = llist;
70
21
71
22
72
- cout << " ##########" << endl;
73
- cout << " ------remove all nodes of llist start --------" << endl;
74
- llist.removeAllNodes ();
75
- cout << llist.getNumberOfNodes ()<< endl;
76
- cout << " ------remove all nodes of llist end --------" << endl;
77
-
78
- cout << " ##########" << endl;
79
- cout << " --- insert after given node start ---" << endl;
80
- cout << " --- before insertion 9000 after 4 ---" << endl;
81
- newList.printAllNodes ();
82
- newList.insertAfterGivenNode (9000 , newList.findNode (4 ));
83
- cout << " --- after insertion 9000 after 4 ---" << endl;
84
- newList.printAllNodes ();
23
+ // llist.removeNode(llist.findNode(7));
24
+ // llist.removeAllNodes();
25
+ // llist.findNode(3);
26
+ // llist.printAllNodes();
85
27
28
+
86
29
87
30
return 0 ;
88
31
}
0 commit comments