-
August 22nd, 2013, 10:54 AM
#1
How to figure time complexity of algorithm
Lets say you have to find a pair of matching socks. You could:
1) grab sock from basket.
2) grab another sock from basket. If it doesn't match throw it to the side. If it matches goto line 4.
3) repeat line 2
4) your done.
How would you go about figuring time complexity of this algorithm or the following one.
1) grab sock from basket lay it on the bed.
2) grab another sock from basket. If it doesn't match any previous socks already on bed lay it on the bed. If it matches any previous socks goto line 4.
3) repeat line 2.
4) your done.
How would you find it from these two cases.
Thanks in advance.
Jack
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|