//Add
// Big O notation: O(1)
//takes in a new node to insert
if head equals null or head.data >= newNode.data
newNode.next = head
head = newNode
return head
currentNode = head
while currentNode.next is not null and currentNode.next.data < newNode.data
currentNode = currentNode.next
newNode.next = currentNode.next
currentNode.next = newNode
return head
//Delete
// Big O notation: O(1)
//takes in a value to delete
if head.data equals value
head = head.next
else
lastNode = head
currentNode = head.next
while currentNode not equals null
if currentNode.data equals value
lastNode.next = currentNode.next
else
lastNode = currentNode
currentNode = currentNode.next
//Searching
// Big O notation: O(n)
//takes in head and value to search
currentNode = head
while currentNode not equals null
if currentNode equals value
return currentNode
currentNode = currentNode.next
//Traversal
// Big O notation: O(n)
//takes in head
if head equals null
return
currentNode = head
while currentNode not equals null
result = result + currentNode.data + " "
currentNode = currentNode.next
return result