Created
May 2, 2023 13:14
-
-
Save vitsky91/9f9a01a179fa595b8f34f742942fc9b1 to your computer and use it in GitHub Desktop.
Linked List - Swift Enums
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
indirect enum LinkedListNode { | |
case head(value: Int, node: LinkedListNode) | |
case node(value: Int, next: LinkedListNode) | |
case tail(value: Int) | |
} | |
let linkedList = LinkedListNode | |
.head(value: 0, node: | |
.node(value: 1, next: | |
.node(value: 2, next: | |
.node(value: 3, next: | |
.tail(value: 4))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment