From January 2015, she started to practice leetcode questions; she trains herself to stay focus, develops "muscle" memory when she practices those questions one by one.
2015年初, Julia开始参与做Leetcode, 开通自己第一个博客. 刷Leet code的题目, 她看了很多的代码, 每个人那学一点, 也开通Github, 发表自己的代码, 尝试写自己的一些体会.
She learns from her favorite sports – tennis, 10,000 serves practice builds up good memory for a great serve. Just keep going.
Hard work beats talent when talent fails to work hard.
A minimum heap C# code is needed for the Email everywhere algorithm in a booking woman in tech contest, so Julia googled and found the C# code. She put together with the algorithm and then she scored 30 points with a full score. Learning to use heap is a great mark for Julia, she knows that completely sorting is expensive, if only max and min value is needed, better to use binary tree, not binary search tree. Julia starts to learn using heap when she work on algorithm problem solving.
C# code is here. Need to add some test case and do some code review.
It is most rewarding experience to learn and score full 30 points on this algorithm called Email Everywhere. Julia did not have time to practice C# code to write a min heap or max heap using array. She tried so many things but this time she borrowed the code from the internet, and then make it work for the algorithm.
It is a good experience to write brute force solution, and then continued to improve and solve the problems. Look at the submission of the algorithm, Julia learned the min heap and algorithm design through the contest. Well done. Here is the report of submission:
From 2.5 to 4.17, and then 19.17 and then 30 full points, Julia tried to review each step and then write down how she works better next time.
Julia spent so many hours to work on DFS - recursive function, or using a stack to do the work. Search the blog using DFS and then a lot of work will be listed here. But Julia worked on in the contest more than 6 hours from 2 pm to 8pm, and she still could not figure out 5 wrong answer test cases.
Algorithm problem solving is such a fun activities. Through those long hours problem solving, Julia now knew so many things she had to learn and work on. This booking contest just let her know that how challenge the work will be if she lands a job to deal with millions customer.
The last submission in the contest scored 30 out of maximum score 50. The code is here.
5 runtime error, not timeout.
The submission scored 25 out of maximum score 50, timeout 5 test cases at least. The code is here.
The submission score 23.75, timeout and runtime error. The code is here.
This is the great workout for Julia to learn the algorithm. She replaced recursive solution with a stack, and then she worked on the idea to avoid duplicated calculation. Every node is visited and then sum and maximum value will be recorded, only better candidate can allow to visit again.
From the score 23.75 to 30, Julia worked on the problem solving, understood how important to keep the code as simple as possible. She worked on her last submission to clean up code more than 30 minutes. She learned to discipline herself to show clean and readable code.
It was a beautiful day Sunday and Julia went out for Vancouver sun run. After 10 km running and walking, she was recovering quickly starting from 1:00 pm and then spent more than 60 minutes to study Google managers and directors, facebook managers and directors on linkedin profile.
Related to the last Friday work experience and Saturday booking woman tech contest, Julia likes to do a small study about current managers and directors in high tech companies through linkedin.
Study of managers and directors
Julia does not have a concrete idea what to study and what to look for, she just spent first 20 - 30 minutes to read some managers profiles and then figured out their career path, and then go from there.
She watched the tennis professional players press interviews and also browsed more managers profiles.
Article about Li Fan is here to join pinterest back to Sept. 2016. Techcrunch article is here about former Google image search director Li Fan joined pinterest in 2016. 3 minutes talk on youtube is here.
Five lessons of scaling pinterest - good time to read an article talking about lessons. Article link is here.
Watch again press interviews of tennis professional players - learn how to review player, what are the strong player showing in their talk, thought process?
It will be a busy weekend. Julia has to catch up tax return study and preparation this Saturday. She likes to do some study her own on tax issue and visit one of H & R block. But Julia just loves the competition and she likes to experience again the competition.
The contest will have another 30 hours to go. Julia will plan to work on at least 3 - 4 hours this Saturday.
Read the article - Learn from the best player - Simran Dokonia, play to win, linkedin profile is here.
Now it is 4:05 pm, April 22, 2017. Julia solved a few problems. Here are the ranking progress report. Julia still has a few hours (15 hours) to work on. Tomorrow morning is Vancouver sun run, Julia has to go to bed early.
Julia felt much better because she is learning from every problem solving. She was busy to work on debugging the code and thinking, such a great workout.
4/23/2017 12:51 am
That is the best I can do. Here is the report:
Follow up after the contest
1:58 pm, April 23, 2017
Julia read the above comparison, she spent over 860 minutes, almost 14 hours 20 minutes scored 88 points, whereas the 20th only spent less than 605 minutes, around 10 hours to score 245 points.
The 20th player scored extra 157 points from 88 to 245 points, and also spent less than 5 hours compared to Julia.
One thing Julia found out is that players are very consistent on the performance. To compare with top 5% performers, Julia has to catch up more skills - reading, debugging, design of the algorithm and data structure, etc.
It is a good practice to write down a simple test case, and go over the test case and explain the algorithm, write down every step and every detail to show how you are serious about the talk; show some good analysis by writing down some notes, like mathematical expression, some terms about computer algorithm, and things like pseudo code will be perfect because a person knows recursive function, her writing will terminate because one iteration is enough.
Julia recalled her only experience in 2016 and then she knew that she should write down more transcript instead of code. Try to put 10 minutes in coding writing, first 10 minutes to write down the problem, and everything to ensure the problem is communicated properly, and also the idea will help to lead a bug-free solution.
Julia learned in April after 5 or 6 mocking experience, suddenly she did not scare at all. She likes to play free and use this non-algorithm approach.
Recursive function or DFS algorithm is the most popular algorithm Julia learned to master in 2017.
Flood fill algorithm is a term Julia learned through wiki article reading in 2017. Julia learned the algorithm through various situations and found out that it is very important to follow the structure to practice. The structure she follows starting less than 1 month is to start from one small example, work through the example. If Julia has 30 minutes to work on the algorithm, she will spend first 10 minutes to work on a small example, go over the problem and think out loud with ideas to solve the problem, write pseudo code, and walk through some test cases. To show the intelligence, Julia will write down something to help herself track the progress. And next 10 minutes to write the code, and 10 minutes for potential issues.
As showed in the following transcript, Julia went through the sample test case, and then counted one by one island and marked them using A, B, C, D, E, F. And then she went over the detail in 10 minutes to write and communicate ideas through her writing. She likes to write and reminds her to go through everything in her preparation to a perfect bug-free coding stage.
Good conversation is like this, Julia said that there is 5 of islands, the peer said that it is six. So Julia just marked one by one using A to E, and then she found F at last moment. It is called cognitive ability, both of players know each other through counting activities. Good warmup. Julia did very well on this, showed that she could collaborate very well, adapt to uncertainty and learn.
Read the article one more time, Google hire, write down notes here:
General cognitive ability - the capacity to learn, the combination of raw intelligence
A diligent interviewer will probe deeply to assess the veracity and thought process - how to do it?
People who score high on conscientiousness “work to completion”—meaning they don’t stop until a job is done rather than quitting at good enough—and are more likely to feel responsibility for their teams and the environment around them.
Julia chose a small study topic about app academy to end her busy day, 2 more hours to go. She had a mocking experience tonight at 8:00 pm and wondered how the peer performed so well. And then she found out a new topic for study tonight. The peer went through the training of App Academy. So interesting to know a new academy institution, very creative, 4 months training, no tuition until you find a job in 12 months after graduation, is that cool?
Read 10 - 30 minutes first. App Academy on linkedin is here.
It is interesting to know that the advanced algorithm in hackerrank week code contest sometimes is purely a mathematical analysis problem. The score of the algorithm is 100. Julia likes to be able to solve one of them in the short future.
Today Julia likes to study if Euler algorithm on Hackerrank is good choice to practice. Mathematics is a golden mine, if Julia starts to work on the math again, she may find herself to be able to score extra 100 points on hackerrank week code contest.
Based on the experience to work on algorithm "Colliding Circles" in week code 31 contest, Julia learned and practiced one more time how to write clean and efficient DFS algorithm using recursive function. Those 5 hours she experienced a lot to construct a DFS - recursive function.
It was very exciting to make a small change in the two submission, solved test case 4, scored extra 3 points from 8 to 11. Julia learned to be extremely patient to learn to write best recursive code. The experience is documented in this blog.
Here is the short story of reducing time complexity of calculation O(n2) to O(n). There are n balls, any two can collide, so there are total n x (n-1) options; each collide the area gets increment of 2 x ri x rj, sum (2 x rix rj) is O(n x n) time complexity. Since n is 105, so n x n will be 10000 million; time complexity will be lowered from 10000 million of multiplcation to 100000 calculation of summation. As showing in the following code snippet, the difference of two summations is the 3 hours work/ 3 more points,
(r1 + r2 +...+ rn)2 - (r12 + r22 + ... + rn2).
More detail please refer to the colliding circles source code line 82 - 87 for extra 3 points.
However, using mathematical analysis, the algorithm can be designed with time complexity lower to O(n). It was hard to get it in the contest.
One player did a lot of Euler algorithm heavily recently, the player got mathematics' Ph.D. degree from 1996 to 2000. Julia was wondering if she can learn something from other player's practice.
Those Euler algorithms on hackerrank may be a good place to practice good mathematical problem solving.
Here is the leaderboard Julia tried to study next 30 minutes - 10:06pm - 10:36pm. Who are those talents? What are the motivations to have those talent group? Name 3 of them and try to find motivation behind.
Top player Yuehang Chen - profile is here.
Yuan Li, profile is here.
It is a wise decision to study the leaderboard for at least 30 minutes after the contest compared to those long hours to work on contest to get a silver medal day and nights. Julia did like to look into range of 300 - 800 as well, certainly she likes to study those top 300 range.
One of the players shares his blog who score over 200 points compared to 90 points Julia made.
The first one is the second year university student in Zhejiang University, China.
It is a very good practice to spend over 5 hours for each hard algorithm in the contest. Julia now has chance to do some research how to improve contest performance, study how to improve 30% performance to 100% on those two algorithms.
Three algorithms are showed in the following image:
Julia plans to take some time to review those algorithms and then write down small tips to help her to improve.
Study after the contest
Read one hackerrank player's blog about contest. Link is here.
It is the first time Julia spent over 2 hours in the week contest to work on an advanced algorithm in 2017.
2 hours Research
Julia likes to challenge her research ability to work on an advanced algorithm, and try to come out ideas, simple code, and try to break zero - score any point if she can. At 8:47 pm 4/16/2107, there are over 1095 players score more than 8 points, maximum score is 72.
Follow through the discussion, the brute force will be able to score 8 points. It is not a bad idea to come out the brute force solution first.
It is a good challenging to make some progress on this colliding circles algorithm. Julia spent over 5 hours on this Sunday after church service around 1:30 pm, up to 6:54 pm she managed to make the code work using recursive solution first, and then continued to improve time efficiency. Here is the progress report on this algorithm. At the end of day, the score will go lower after all test cases are run.
It is a good training to learn how to stay calm, and review the time complexity, how to lower O(n*n) calculation to O(n) calculation. Julia tried to get more training on recursive function - DFS search algorithm.
It took Julia more than 6 hours to work on coding and then the algorithm can pass second sample test case and scored 8.78 first time at 4:00 pm this Sunday afternoon. So as a programmer, Julia also liked to be nitpick at her code and then questioned her practice, and then solved test case 4.
So exciting that Julia can bring herself first time in top 10% in the hackerrank contest, she could figure out how hard it takes to get a silver medal.
It is also very good practice to warm up simple probability knowledge when coding this algorithm. Once Julia figured out the probability is important in this algorithm, she started to make points on the algorithm.
Coding is fun
Julia only has 3 hours left for the contest, she has to finish everything before 10:00 pm. Now it is 7:18 pm.
Use some bible verse to celebrate the learning of the algorithm, favorite verse from proverbs or psalms.
Follow up after the contest
April 17, 2017 9:19pm
Code submission is here, score 11.28, extra 3 hours hard work.
First submission with a score is here, score 8 after 5 hours work, score 7.82 out of 65.
Julia spent 90 minutes to play contest of Leetcode weekly contest 28. She was too busy to read the problem statement and then she never felt that 90 minutes can fly that fast. She just could not believe that she is doing better than week contest 27.
Here is the picture to show some result.
Try to figure out how to make sense those problem statement on Leetcode, too much wording but Julia could not understand the last 2 algorithm.
Study the leaderboard.
In the contest 90 minutes, Julia took turns to read last 3 algorithm and could not understand any of them, she did more than 3 rounds, and then she decided to give it a try second algorithm. She understood the math very well and just could not believe that it is a medium algorithm, it is so straightforward, she thought about a lot of ideas at the first.
She was training herself to read problem statement, do not give up, keep reading and thinking, round robin fashion on those 3 algorithms.
Statistics of the contest
Score is 9, Julia solved first two algorithm in first 80 minutes. Rank is 393/ 1848, score 9's range is from ranking 170 to 393.
Julia was busy with Hackerrank week code #31 this morning starting from 8:00 am and she had some issues about her attitude to test cases, last night she stayed up to 1 am to work on coding with test cases. She failed 50% test case of minimum spanning tree, and she thought that this Saturday morning time is the wonderful time to learn how to strength her test skills, she tried to fix those failed test cases today.
Last night 10:00 pm she had a mocking experience but she felt kind of disappointed, because she liked to get more mocking comment. Last night she did not get optimal solution. She could not think freely to reach optimal solution.
But today 10:00 am mocking experience is a very good experience, best of 8 mocking experience. She spent over 10 minutes to work on time complexity analysis, O(k2) -> O(klogk) -> O(k), she stopped before she thought about O(1), she knew that it is not so good to find minimum value using O(k) time. She asked for a hint, and then she was given to think heap sort. She got it right away, O(1) to get the minimum value if minimum heap is used to store k elements. Because all k numbers does not need to be sorted, only minimum value is needed.
Using O(k) time to get minimal is not optimal, use space to trade time, use a binary tree - a data structure to store k element, minimum value is the root of binary tree, that will be O(1) time. Actually it is named minimum heap.
Small talk about messed array
The 30 minutes mocking experience is here with transcript, thought process, hint given and C# code.
This is the first time in last 8 experience Julia got rate of 7 for her code. 30 minutes is long time for a conversation. Writing code was to write down what she described in the test case. Even though Julia worked on first 10 minutes without coming out using heap sort, she understood the solution and how to approach the problem by going through a simple test case [1, 2, 3, 4, 5].
"Really familiarize yourself with the sorting algorithms. You definitely understand them but get to a place where you can recall them more intuitively."
It is a good practice to track the progress, now Julia ranked around 600 at 3:38pm 4/14/2017. She is still working on the algorithm, but she managed to pass some test cases and scored 24.75, first 7 test cases only 0, 1, 2, 6 test cases are passed. The score will be less because there are 7 more test cases.
Here is something she likes to show the progress compared to a Googler:
Right now, she needs to review her code, and read the problem statement a few more times and see if she misses anything important.
Julia likes to work on the next algorithm "Colliding Circles", it is fun and she thought about Combinatorics she learned in her mathematics study. She checked that another googler - yaray scores full score on this colliding circles algorithm.
Follow up after the contest
April 17, 2017 9:11pm
The submission in the contest is here. Failed a few test case, only score 17.68 out of 55.
Julia likes to work on spanning tree algorithm, even though it is hard algorithm, but Julia did spend some time on the algorithm before. So, it is also a good practice to review previous contests related algorithms.
Julia started to read minimum spanning tree, understand why union set is better than DFS algorithm to detect cycle in the tree algorithm.
Minimum Spanning Tree
Here is the tutorial she studied for the algorithm.
minimum spanning tree - April 13, 2017
Hackerearth.com -> graph -> minimum spanning tree -> tutorial
Kruskal's algorithm -
Learn the algorithm - using disjoint set / not DFS
check how it is not connected? Using DFS algorithm to search - O(V + E)
Value of friendship
Code review of algorithm "value of friendship" is here.
Julia learns to stay in the contest and enjoys the hard work to solve some problems. Here is the status at 9:17pm 4/13/2017. Julia compared to the best performer.
Hackerrank Week code 31
It is not easy to gain any point on advanced algorithm beyond medium algorithm on week of code contest. But Julia found out that she started to learn a few algorithms last 12 months. One of her favorite learning is binary index tree, so much up-and-downs feelings with the learning, but she wrote a very good question kindergarten adventures on code review website. She learned that she should not trust her feelings, it may seem to be difficult, but with calm and systematic way to handle the algorithm, use her strong data analysis experience, no algorithm should be hard. No mountain is too hard to conquer.
Sudoku solver is such interesting problem and Julia wrote more than 3 solution in her practice back in 2015. Here is one of the blogs, and also Leetcode 37: sudoku solver is also very good material to review the algorithm.
Sudoku solver talk
Here is the C# code written in 30 minutes mocking experience.
Transcript is compiled to make it work. C# code is here.
Highlights of a few corrections:
3 nested for loops. The first 2 for loops is to find the first cell with value -1 to do search, try numbers from 1 to 9 and start a DFS search, if all of them are failed, then return false; otherwise return true.
Need to talk about optimization, use the first one with value -1 to start DFS or other cell?
There is a short story about the sliding window algorithm. Julia still remembered that 2 years ago she was asked to solve the algorithm to search a minimum substring, but she failed to solve the problem.
After a week analysis of the algorithm, Julia decided to start to write a coding blog, practice coding every day. She understood that people were helping her to try out the real experience, she was treated nicely even though she had bad performance. She likes to give back to others, shows her generous to share, most likely she will share her failure, struggle at the beginning. She started to write day by day, now her coding blog is like a tree planted by the water that sends out its roots by the stream (Jerimiah 17:8).
Highlights of good things and bad things in the code written in mocking 30 minutes:
1. line 2 - 19 writing of algorithm analysis is very good. 2. line 2 - 19 missing the slide window left point move forward design - skip more than one char 3. line 63 - 65 - this is a bug, for example, unique string "xyz", slide window "xyyz", if next char is x, then "yzx" will be shortest. It is a bug to reset start and end pointer. 4. line 74 - 76 - if statement should be a while loop
need to add checking whether minimum string is found or not.
Final version after mocking experience is here. C# version - revision 3.
Fully understand the test case first
In order to write good and working code, Julia had to force herself to work on a test case first next time. Here is the test case she worked on April 11, 2017, a few days after mocking experience. Work on the simple test case again and again, write down the analysis here (4/11/2017):
Find string using sliding window xyz xyyzx
Iterate the string one char a time
When to move left pointer? skip two chars in a row - "xy"
xyyzx -> yyzx, remove left pointer, skip x
yyzx -> yzx, remove left pointer, skip y
Do one thing a time.
Every iteration, add the visited char to the slide window, add char to the slide window if it is new, otherwise increase the count.
Check left pointer to see if it can move forward, make sure do a loop, sometimes it can skip multiple chars.
Check if slide window contains a string including all unique characters.
On the other hand, seeing you
find your way out of a difficult situation tells a lot about your character,
how you perform under pressure, your ability to think on your feet and your
problem solving skills.
1. Not thinking about an algorithm
Make things simpler for yourself. Write down an example on the board and think
about just solving that particular instance of the problem by hand.
Small test case -> generalize it back into an algorithm form.
Julia, please validate the argument. Sounds like true to Julia in 2017.
People tend to bomb their first few sets of interviews. This is mostly because
they don’t have sufficient practice with how to handle that pressure of solving
an unknown question.
Coding is a lonely game even Julia worked on code review website and also had mocking experience, sometimes Julia missed the physical experience of tennis sports, people meet on the court and exchange ideas face to face.
Julia has to deal with different emotions when she goes through coding and full time job. She likes to keep learning. One thing she starts to try first time and write a blog is to watch the press conference of tennis player after each round of Australian Open 2017 and document her learning.
Watch one talk a time. Roger Federer had over 5 press conferences. Try to catch up some thinking process of top players, deal with loss, win, emotion, health, practice, everything.
One thing Julia likes to work on is her interview skills, give her a talk, she found out that she is better to learn from top professional players. More real, more related to her reality, she likes to seek open fair opportunity to advance and grow her career, by hard working and showing what she learns through a lot of practice.
Before he has favorite, now enjoy every week. Building block of his career?
Mental challenge? Dubai in lockroom, need more time off before Miami. Lack of energy. From zero, finished middle night. Felt right away, good. Last Nov., Dec., set some goals for season, top 8 in the season. Give me time to get there. Reassess the goal, where is the plan?
Stage of come back? Confidence does wonder. Too much fun, how hard it is to work on. ...
April 8, 2017 Problem statement Julia spent less than 90 minutes to work on the algorithm in Leetcode week contest 27, from 6:30 pm - 8:00pm.
Her C# code in the contest is here. Need to work on more on this medium algorithm, Leetcode 554.
3 medium algorithm, each takes 20 minutes. So, the code should be less than 50 lines for each algorithm.
Time just flies too quickly when Julia worked on Leetcode 554. She managed to work out the sample test case, but it does not pass Leetcode online judge. Will work on improvements later.
Julia, you should think about using min heap to track line sweep algorithm, therefore no run time error, which is probably timeout.
Time complexity of algorithm Julia implemented, every node is visited more than once at least, upper bound is not sure, some node is visited multiple times; upper bound cannot be determined.
Better to choose the algorithm only visits each row each brick wall once algorithm, the time complexity is deterministic.
April 10, 2017 10:00pm
Julia did not notice that her choice of algorithm had timeout issue. The upper bound of the algorithm cannot be determined.
April 10, 2017
Julia, you over engineering the algorithm. Make it simple and quick.
Julia, you have to measure the algorithm by your engineering power, determine which idea to go for it depending on time constraint. 20 minutes does not allow more than 50 lines of code, bug-free. It is impossible.
April 11, 2017
It should be your routine before you write any algorithm code, try to analyse time complexity.
Aging is a great progress, Julia learns how to work with young generation. She also chose to study Janko - how he helped young generation player - a junior player ( 17 years old) to work on ranking 300 to ranking top 100 ATP players. Janko was top 10 player when he gave out his advice to practice with young player, back to 2012.
H-tree is constructed by layers, next layer will start from four corners of H as centers, and the size will be smaller one.
Problem statement - Read this Java implementation from princinton.edu - H-Tree
Julia started to study mocking interview, and see how many things she should work on. Instead of writing a simple recursion version, Julia chose to write a BFS solution using queue. It is a good practice and also showed her passion to write a solution and learned from her mistakes on the mocking.
Spent over one hour to make the C# code bug-free and code readable.
Also, line 83, correct the calculation of length using square root 2. C# code is here.
Again, make variable names shortest, line 90 - 95. C# code is here.
Things learned in the mocking experience:
1. Julia thought out loud using queue to implement the solution, the interviewer gave out hints to use stack, depth first search;
2. Julia thought about using stack but forgot about recursive function is a natural stack; in other words, using simple recursive function call.
BFS/ DFS difference - DFS can use recursive call, internal stack.
3. Using Queue will work, but the depth should be pushed with queue with center node's information.
4. It is important to stay calm, write instructional code.
Highlight of good/ bad things in mocking experience
(the C# code in mocking experience, good thing is highlighted using brown color, bugs and mistakes are in yellow color):
0. line 1 - 12 work on a H-tree understanding, write a small test case. Understand the H-Tree draw lines, and also requirement of starting length and depth. 1. line 18 - 27, write an internal class Node, define two variables, node and depth. 2. line 22 - 26, Write public constructor of Node class to set up a new node 3. line 30, Function name is very good - DrawHTreeToDepthUsingBFS 4. line 30, Function DrawHTreeToDepthUsingBFS's design flaw - return argument should be IList<Node>, not IList<Tuple<int,int>>, missing depth information. Depth information is needed to calculate length of H-Tree. 5. line 29, time complexity is correct? Need to write a recurrence formula first, and then time complexity. 6. line 34 - 37, depth <= 0 will be better 6B. line 39 - syntax error - duplicate new Node( 7. line 41 - Enqueue method - input argument should be variable - node 8. line 43 - adjustLength = depth; should be adjustLength = startLength, mix length and depth two variables 9. line 57 - 64, should add checking of depth, add H-tree is conditional - major issue 10. line 57 - 60, 4 corners of H, new center node's x, y values are not correct.
Julia, you have to learn from tennis training coach - Janko Tipsarevic - train yourself to be able to write a bug-free, very instructional code. When in real matches, a lot of emotions are mixed with pressures, will to win, anxiety and pressure, you will not notice those mistakes and errors.
Next time, try to write much more slowly, make sure that every line of code is bug-free, syntax ok, no duplicate code.
Through this mocking experience, Julia learned that she still had to practice more on BFS algorithm using Queue, Julia was very comfortable to write and understood that either BFS/ DFS will work out with no problem.
Julia did not have time to go over the code because the peer did not want to wait after 30 minutes.
Also, Julia did not come out using recursive function to write, even after hints. Julia was nervous because she asked help to understand H-Tree with the test case.
1. Learn to interview people with different background, technical strength; Learn to write down notes and give out good advice.
2. Do not book more than one mocking a time.
3. Try to improve score of problem solving skills, ratings are low 3 of 7.
4. Take it slow, write instructional code, avoid duplicate code. Using meaningful variable name, function name.
5. Go through up-and-downs through mocking experience, learn to appreciate the time of peer. Try to
manage better the 30 minutes time. Avoid lengthy discussion, be very diplomatic, writing is most important part to show good skills and analysis.
6. Work on a small test case first, this part is very good warmup and prevent bugs in writing and design correctly first time.
7. Make the mocking experience more structured, write down a small test case to understand the problem, show some analysis, and talk about design and choices I may have.
8. All issues Julia had on real experience are reproduced in this mocking experience. Julia, practice more. Do not give up. Write down your feelings, and issues. You will sort it out later.
Add 1, 2, 3, 4, 5, and then keep tracking medium value to make sure that it is accessible using time complexity O(1).
Julia teaches herself how to analyse step by step and get into the design of data structure this March 2017. First try, her thought thinking process looks naive from this blog but she likes to write down thought process, and continue to work on it. Life is much easy if Julia chooses to start baby step, reexamine things involved, small talks about every concept which should have been considered in the design process.
Julia likes to spend time on a test case rather than thinking about so many ideas/ articles/ practice she had worked on related to search median algorithm, that is a game to test memory. Instead Julia likes to show a better way, from her training of mathematics courses through her universities - SJTU, FAU math and computer science department, nothing can beat a small example and powerful message of problem solving, it is simple process but it brings out a good thought thinking process - maybe showing great mindset. Time is well-spent on the small test case.
Baby step talk about data structure design
Julia likes to practice this to get her familiar with heap concepts and also max heap and min heap.
Here we go.
First 1 is coming, put 1 into left side data structure, she is not sure what kind of data structure should be.
The median is 1, no problem, just to get the first and only number in left side.
Left side Right side
And then, 2 is coming, Julia likes to put Right side.
Left side Right side
Median is (1 + 2)/ 2 = 1.5
Now, 3 is coming, we have to decide 3 goes to which side, why?
Binary search tree vs binary tree
1 2 3, 2 is the medium, we like to keep 2 at the top of data structure, first we decide to let 3 join which side, left or right?
To allow first number 1 goes to left side, max heap is used for left side data structure. And there is implicit rule, left side data structure saves left half of the numbers, smaller one.
Repeat, middle element is the root of tree, no need to sort, binary tree, smaller half of numbers is in left side data structure. We can make it a max heap.
Rule 1: Left side data structure saves left half of the numbers - smaller ones
Because it is there is no need to sort everything which costs unnecessary time, using binary tree instead of binary search tree, to make median calculation be O(1), we like to keep the middle element at the root of binary tree.
Left side - Max heap
So, 1 is smallest value, go to left side, left data structure uses max heap.
Left – 1
Right - 2
Right side - Min Heap
3, right side is min heap.
Extra rule - left size always not smaller than right side
Keep the left side’s size >= right side
Adjustment - heapify
Move 2 from right side to left side
Left side: 2 1 (starting from root node, and then level by level)
Using array to represent a heap
complete binary tree, 1 2 => node's value is smaller than child's value, swap => 2 1
Right side: 3
The median is 2, since left side’s nodes > right side’s node + 1
Next 4 is coming, put 4 to right side
Left side: 2 1
Right side: 3 4
The median is (2 + 3)/ 2
Next 5 is coming, put 5 to right side because 5 is bigger than left side data structure - max heap's max value.
On the other hand, seeing you find your way out of a difficult situation tells a lot about your character, how you perform under pressure, your ability to think on your feet and your problem solving skills. 1. Not thinking about an algorithm Make things simpler for yourself. Write down an example on the board and think about just solving that particular instance of the problem by hand. Small test case -> generalize it back into an algorithm form. People tend to bomb their first few sets of interviews. This is mostly because they don’t have sufficient practice with how to handle that pressure of solving an unknown question. 15 mocking interview - systematic way
A note of thankfulness
Julia likes to write a small note to thank Brooklyn to help her on writing better on this blog's introduction section, who is a graduate of linguistic major from university of Victoria in 2015.Brooklyn gave her comment about blog writing in general, and she said that Julia writes very well now.