We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c948124 commit 803a382Copy full SHA for 803a382
Linked List/linked_list_even_or_odd.go
@@ -5,8 +5,8 @@
5
Use a 2x pointer. Take a pointer that moves at 2x [two nodes at a time]. At the end, if the length is even,
6
then the pointer will be nil; otherwise it will point to the last node.
7
*/
8
+// Time Complexity: O(⌊n/2⌋) ≈O(n). Space Complexity: O(1).
9
package main
-import "fmt"
10
11
// has two fields [data] of type integer and [next] of type *node (holds the memory address of next node)
12
type node struct {
0 commit comments