Showing posts with label confidence level of binary search algorithm. Show all posts
Showing posts with label confidence level of binary search algorithm. Show all posts

Sunday, July 1, 2018

Binary search algorithm mishap

July 1, 2018

Introduction


It is one of three mock interviews I did on June 30, 2018. I made a mistake to write wrong statement to get rid of half of number, and then I spent over ten minutes to try to fix the bug, since the web compiler shows the return of array is empty.

What I can tell


It is so interesting to observe how I reacted this bug and what I did those 10 minutes. After more than 10 times to work on the algorithm, over 50 times binary search algorithm practice last 6 months.

Stay humble. Stay simple. Also be confident on C# class List.ToArray(), understand better about empty array console output.

Here is the C# code I wrote with a bug on binary search algorithm, and then I ended up adding Console.WriteLine based on the peer's advice. So fun to review the mistake. What a mishap!

Practice is fun