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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Binary search

A

Binary search ():

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly