Skip to content

feat: add README file to traversal #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: add README file to traversal
  • Loading branch information
Agatha Bahati committed Mar 27, 2023
commit 28b303cb6ee41c7bd046219daf10b1de5055de26
47 changes: 47 additions & 0 deletions linked_lists/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# linked list values

Write a function, linked_list_values, that takes in the head of a linked list as an argument. The function should return a list containing all values of the nodes in the linked list.

## test_00

```
a = Node("a")
b = Node("b")
c = Node("c")
d = Node("d")

a.next = b
b.next = c
c.next = d

a -> b -> c -> d

linked_list_values(a) # -> [ 'a', 'b', 'c', 'd' ]
```

## test_01

```
x = Node("x")
y = Node("y")

x.next = y

# x -> y

linked_list_values(x) # -> [ 'x', 'y' ]
```

## test_02

```
q = Node("q")

# q

linked_list_values(q) # -> [ 'q' ]
```

## test_03

`linked_list_values(None) # -> [ ]`