Sunday, December 3, 2017

How to find smallest number?

Dec. 3, 2017

Introduction


It is 30 minutes and then I start to learn what I put into those 30 minutes to show what I can solve the algorithm. This is the smallest number to solve and it is kind of good one to demo the algorithm space and time analysis trade-off.


Code study 


Here is the C# code. I did whiteboard testing, and then I could not spot the bug missing a break statement, I added line 43. The code had a bug related to index-out-of-range error, so I add else if statement from line 26 to 29. The peer was very patient and gave me the test case to point it out.



No comments:

Post a Comment