Showing posts with label pancake sort. Show all posts
Showing posts with label pancake sort. Show all posts

Thursday, March 29, 2018

Being an interviewer: Pancake sort

March 29, 2018

Introduction


It is my interesting thing to learn how to be a good interviewer. Since I was so patient and also gave some advice like "write readable code" and "write simple code", I ended up knowing that a very competitive programmer with so many medals on hackerrank, and my favorite codeforce.com, the expert competitor.

Code review


Here is the C++ code I reviewed. Most of time the peer worked on the problem related to const in C++. The flip function change cannot be done in place, we debugged the code and found the issue.


Saturday, March 24, 2018

Sorting algorithm

March 24, 2018

Introduction


I had two days vacation and also had a friend visiting from Shanghai. I just came back to work on mock interview, I had some difficulty time to run whiteboard testing, and then need some time to fix the bug.

Code review


Here is my C# code to pass all test cases. I made two mistakes in my first writing, and then I had issues to pass all test cases. I found the problem on line 15 and add line 20.


Sunday, January 21, 2018

Sort algorithm

January 21, 2018

Introduction


It is the sorting algorithm with time complexity O(n2). I had a mock interview today at 8 PM, so I wrote one more time.

Code review


Here is the analysis and code. I tried to write a better analysis this time.