File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ def __repr__(self):
3030 nodes .append (f"[{ current .data } ]" )
3131 current = current .next_node
3232 return '-> ' .join (nodes )
33+
34+
35+ def search (self ,value ):
36+ """Search the linked list for a node with the requested value and return the node."""
37+ current = self .head
38+ while current :
39+ if current .data == value :
40+ return current
41+ current = current .next_node
42+ return None
3343
3444 def is_empty (self ):
3545 """Return True if the list is empty."""
Original file line number Diff line number Diff line change @@ -10,3 +10,5 @@ int main()
1010 // Print the value of 'num2' to the console using printf function with format specifier %.2f. This will display only two decimal
1111 return 0 ;
1212}
13+
14+
Original file line number Diff line number Diff line change @@ -7,4 +7,6 @@ public static void main(String[] args)
77
88 System .out .println (myrec .doRecursion (4 ));
99 }
10+
11+
1012}
You can’t perform that action at this time.
0 commit comments