Showing posts with label Leetcode 230: Kth smallest element in a BST. Show all posts
Showing posts with label Leetcode 230: Kth smallest element in a BST. Show all posts

Friday, March 23, 2018

Leetcode 230: Kth Smallest Element in a BST (Julia 2nd practice)

March 23, 2018

Introduction


It is time for me to work on the algorithm called Kth smallest elment in a BST. I like to write 10 ideas based on the discussion of Leetcode 230.

2nd practice



Leetcode 230: Kth Smallest Element in a BST (Julia 1st practice)

March 23, 2018

Introduction


It is time for me to work on the algorithm called Kth smallest elment in a BST. I like to write 10 ideas based on the discussion of Leetcode 230.

1st practice


I like to write code based on this discussion by yavinci.

Sunday, September 3, 2017

Being an interviewer: Find largest smaller binary search tree key

September 3, 2017

Introduction


It is the great learning experience to watch a 2nd undergraduate student to perform the algorithm. The peer did very well on the analysis, but the execution of the algorithm is kind of weak. I need to step in and ask a good question about the iterative solution.

Evaluation 


This is the first time I show my evaluation as an interviewer. It is such a great activity that I meet a new person and also help the peer to learn an algorithm.

I still remembered that back to 2006 I applied the instructor job in united states, I was afraid to write and speak out, and I did send out over 20 applications.

Now it is so natural to watch how an undergraduate learns the algorithm through various channels outside the university. And I am glad to be part of the process.

I like to learn an algorithm similar to Leetcode 230: Kth smallest element in BST. Also I like to build experience around the algorithm with great reward experience to be part of mocking interview.

Here is the review I got after the mocking interview:


Actionable Item



After the mocking interview, I felt that the peer is not very competitive player. But I learned through his analysis, his calmness and his idea to continue to search right node for bigger value in order to get largest one is very clear and correct. 

I felt pressured that second year undergraduate student will master the algorithm in such a quick pace, how I should do in order to compete? Just be their friends. 

Next time I should copy the peer's code, and analyze the code later. 

Thursday, June 1, 2017

Leetcode 230: Kth Smallest Element in a BST

June 1, 2017

Plan to work on the problem called "Kth Smallest Element in a BST". The problem statement link is here.

Plan to study the algorithm "Second largest element in BST". The link is here.

Introduction


One of most common algorithms is to find the largest value in a set. To solve the problem, Julia has to learn to step back, to find a value in the set first, and then compare to existing largest value when a new value is found.

Julia learned the lesson through the mock experience. The algorithm is to find largest smaller value than the given value in Binary Search Tree (BST). In other words, any number in the BST less than the given value can be added to the set, and the task is to find the maximum value.

The lesson learned is to find a smaller value first, and then save it as maximum value; continue to search and continue to compare with existing max value.

Algorithm study