We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a92cbbe commit 5918b6cCopy full SHA for 5918b6c
Linked List/linked_list_even_or_odd.go
@@ -0,0 +1,25 @@
1
+package main
2
+import "fmt"
3
+
4
+// has two fields [data] of type integer and [next] of type *node (holds the memory address of next node)
5
+type node struct {
6
+ data int
7
+ next *node
8
+}
9
+//has three fields length, head and tail node
10
+type LinkedList struct {
11
+ length int
12
+ head *node
13
+ tail *node
14
15
16
+func (ll *LinkedList) IsLengthEven() bool {
17
+ current := ll.head
18
+ for current != nil && current.next != nil {
19
+ current = current.next.next
20
+ }
21
+ if current != nil {
22
+ return false
23
24
+ return true
25
0 commit comments