File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -18,11 +18,45 @@ int main(int argc, char** argv) {
1818 // Print all nodes
1919 list->print ();
2020
21+ // Print the size of the list
22+ cout << " Size: " << list->getSize () << endl;
23+
24+ // Check has a node with a specific data in the list or not
25+ cout << " Has 110: " << list->has (110 ) << endl;
26+ cout << " Has 111: " << list->has (111 ) << endl;
27+
28+ // Get the node by searching with data
29+ Node* node = list->getNode (110 );
30+ if (node != NULL ) {
31+ cout << " Node data: " << node->data << endl;
32+ } else {
33+ cout << " Node not found" << endl;
34+ }
35+
36+ // Get the node by searching with index
37+ node = list->getNodeByIndex (0 );
38+ if (node != NULL ) {
39+ cout << " Node data: " << node->data << endl;
40+ } else {
41+ cout << " Node not found" << endl;
42+ }
43+
44+ // Get the node by searching with index
45+ node = list->getNodeByIndex (60 );
46+ if (node != NULL ) {
47+ cout << " Node data: " << node->data << endl;
48+ } else {
49+ cout << " Node not found" << endl;
50+ }
51+
2152 // Delete all nodes
2253 list->deleteAll ();
2354
2455 // Print all nodes
2556 list->print ();
2657
58+ // Print the size of the list
59+ cout << " Size: " << list->getSize () << endl;
60+
2761 return 0 ;
2862}
You can’t perform that action at this time.
0 commit comments