Created
March 18, 2018 11:02
-
-
Save Abhishek9634/9b2218e8cf1e991f6021a9407500d6db to your computer and use it in GitHub Desktop.
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
let linkList = LinkList<Int>() | |
linkList.append(element: 0) | |
linkList.append(element: 1) | |
linkList.append(element: 2) | |
linkList.append(element: 3) | |
linkList.append(element: 4) | |
linkList.append(element: 5) | |
print(linkList.description) | |
linkList.insert(element: 100) | |
print(linkList.description) | |
linkList.insert(position: 4, element: 1000) | |
print(linkList.description) | |
print(linkList.search(element: 2)) | |
print(linkList.description) | |
linkList.removeFirst() | |
print(linkList.description) | |
linkList.removeLast() | |
print(linkList.description) | |
linkList.remove(at: 2) | |
print(linkList.description) | |
/* OUTPUT | |
### LINK LIST ### | |
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
############# | |
### LINK LIST ### | |
100 | |
0 | |
1 | |
2 | |
3 | |
4 | |
5 | |
############# | |
### LINK LIST ### | |
100 | |
0 | |
1 | |
2 | |
1000 | |
3 | |
4 | |
5 | |
############# | |
3 | |
### LINK LIST ### | |
100 | |
0 | |
1 | |
2 | |
1000 | |
3 | |
4 | |
5 | |
############# | |
### LINK LIST ### | |
0 | |
1 | |
2 | |
1000 | |
3 | |
4 | |
5 | |
############# | |
### LINK LIST ### | |
0 | |
1 | |
2 | |
1000 | |
3 | |
4 | |
############# | |
### LINK LIST ### | |
0 | |
1 | |
1000 | |
3 | |
4 | |
############# | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment