Algorithms Flashcards
1
Q
Linear search
A
Function linearsrarxh(A,value):
Ptr = 0
While ptr<length[A] AND ptr[A] =! Value
Ptr = ptr +1
Endwhile
If ptr < length[A] then
Return not found
Else
Return ptr
Endif
End function
2
Q
Binary search
A
Binary search ():
3
Q
Output link list
A
Function outputlinklijst():
Ptr = start
Repeat
Node = node(ptr)
Return node
Node = node(ptr - 1)
Until ptr ==0
End function
4
Q
Search for item in linked list
A
Function search():
Ptr = start
Repeat
Node = node(ptr)
If node == item then
Return ptr
Else
Ptr = node(ptr - 1)
End if
Until ptr == 0
Return false
Endfuxntion