Wednesday, November 29, 2017

Recursive function - H tree

Nov. 29, 2017

Introduction


It is the first time I practiced to write down the numbers for a H-Tree using given center value and length and depth. I chose to follow the test case with depth 3 and went over the detail to discuss the algorithm.

I tried to do something different this time. I chose to do different on algorithm analysis.


Algorithm analysis


Here is my transcript to do analysis of algorithm. I am working on presentation skills, make the test case easy to follow.

Given depth = 3, draw H tree. First depth is 3, one H tree; next depth is 2, with 4 trees centered on corners of H. So time complexity can be analyzed by the number of trees, here is the formula:

1 + 4 + 4^2 +... + 4 ^(depth -1) = (4^depth)/( 4 - 1).

Each H-tree has 3 lines to draw, O(1) to draw a line, and then time complexity is O(4^depth).

Next work on H-tree three lines, given center (2, 0), length = 4. Draw the graph below, the four corners clockwise from top left are (0, 2), (4, 2), (4, -2), (0, -2).

    0  1  2  3  4
2  |               |
1  |               |
0  | ---------- |
-1 |               |
-2 |               |


C# code is here.


Tuesday, November 28, 2017

Busy time in a year

Nov. 28, 2017


Introduction


It is the best time of year to relax, enjoy swimming and skiing and everything in the city of Vancouver. I started to swim in the community center, paid $48 dollar for 30 days pass. I started from Nov. 27, plan to swim every day,  5 days in the row, and finish 10 swimming workout first.

Also I practice mock interview every week day 10:00 PM. Surprisingly two of my peers are from the city of Seattle. I have good learning experience through mock interview.

the city of Seattle 


I like to do a short research about the city of Seattle, maybe 20 to 30 minutes.



Catalan number

Nov. 28, 2017

Introduction


It only takes 20 minutes to work on Catalan number algorithm. And then surprisingly, the peer asked me to reduce the space from O(n2) to O(n). The peer said that since you finished early, still 10 minutes left.

Code study 


C# code in practice is here.

Binary search algorithm

Nov. 28, 2017

Introduction


It is my most favorite algorithm last six months. My last practice was in less than a week ago, and I made a mistake about the edge case.

On Nov. 27, 2017, I had chance to review the peer's binary search algorithm and I gave out some code review.

So interesting to work on mock interview, I like to write more about mock interview in general on binary search algorithm.

Common mistakes in binary search algorithm


Let me choose a topic and then I write something around the topic.


Focus on middle value

One time in mock interview, I did start value checking in the base case, and then later peer told me that I should focus on the middle

value. The depth first search is about base case, about middle value. Write simple code as possible, avoid discuss start value.


Structure your code very well


There are two ways to write binary search algorithm. Either recursive or iterative, the structure of code should be well structured.

Continue to work, kind of loop

Do some work for base case

Some logic checking to reduce the range of search to half


End of loop

Edge case 

Sometime half of range is only one node. In order to include the node into the first half range, the condition should be considered carefully to allow equal sign in comparison. One example is here.

The practice of binary search with the edge case bug is documented in the blog called binary search algorithm is always my favorite.

Converge concern

The binary search is to remove half of nodes every step, the base case is to check if the middle value node is satisfied the condition. In

case the search will not converge, it is better to narrow down the next range as (middle, end] or [start, middle. Exclude middle, at least one node is removed each iteration. There is at most n iteration, where n is the length of the size to search.


References:

Past practice 1: blog is here.




C# string class

Nov. 28, 2018

Plan to study C# string class source code. The code is here, by searching using keyword "C# string microlib source code".

I wrote a blog about C# String class API study in 2016, here is the link.

C# strong typing study

Nov. 28, 2017 Plan to study C# strong typing. Two things to read. First one is the question on the stackoverflow.com. The link is here. Second one is to read a blog on this topic. The link is here.

One more recursive function

Nov. 28, 2017

Introduction


It is the fifth time I write the recursive function related to C# GetType() in mock interview. I wrote a blog about past practice. One of blogs is here.

This time I came cross two issues in mock interview on Nov. 28, 2017, one is to write String.IsEmptyOrNull, I did not know that the API is static function of String class. In other words, String.IsEmptyOrNull(string s) is the prototype of API.

The second one is to write value.GetType() == Dictionary, which should be value.GetType() == Dictionary<string, object>. It is time to learn more about C# strong typing.

Here is C# code.

Actionable Items


Plan to read C# source code of string class, and then write down study notes.
Look into C# strong typing related topic as well.



Monday, November 27, 2017

Internet Information Server 8.0 administration

Nov. 27, 2017

Introduction


I started my preparation today to ask myself what is IIS-IUsers, why it should assign the privilege to browser the folder? 

First, I spent 10 - 20 minutes to read questions about IIS-IUsers and IUSRSecond, I read application pool questions, and then started to play with application pool and then my test site had some issue to show the image, I checked the web browser debugger, and then fixed the issue. Once I started to interact with IIS 8.0 and then I like to know more about IIS system design. 

Reading is so much fun and also help me a lot as an administrator. 

Here is the list of articles I went through, I spent whole day Nov. 27 to learn and play with IIS 8.0, went through a lot of learning by going through articles one by one.

Nov. 28, 2017
It is time to get organized. Go to google history and find the list of articles I read yesterday, and then review the content, document the rookie to be an administrator of IIS 8.0. It takes time to build up the knowledge. Baby steps are always fun part of learning.

Interview questions

10 minutes to read:
IIS Adminstrator Interview Questions and Answers, the link is here. (rank 5 of 10)

Top 50 IIS Admin interview questions, the link is here.

Technical article


Nov. 28, 2018
IIS 8.0 Using ASP.NET 3.5 and ASP.NET 4.5  (60 minutes to read, after I spent time to go over the content, I decided to print a paper copy, and then plan to review the content, and mark the content if need. Need to spend more time to look into some keywords)

Technical article


Nov. 28, 2018

Learn how to enable both ASP.NET 3.5 and ASP.NET 4.5 on IIS 8.0. The link is here.

Role-based or Feature-based installation

Name a few role services:

Management Tools
IIS Management Console,

Web Server

Common HTTP Features (Default Document, directory browsing, HTTP errors), Health and Diagnostics (HTTP Logging)

IIS 8.0 Using ASP.NET 3.5 and ASP.NET 4.5  (60 minutes to read, after I spent time to go over the content, I decided to print a paper copy, and then plan to review the content, and mark the content if need. Need to spend more time to look into some keywords)

Technical article


google search ".NET v4.5 classic application pool"

Read the article here:


Technical article


Google search: asp.net IIS server 401 unauthorized

stackoverflow article is here.

Technical article


Top 8 Application-Based IIS Server Performance Tips

The article link is here.

Application Pool Identity Google search


Google search: application pool identity

The article titled Application Pool identities, the link is here.   - 20 minutes to review again.

One argument Nov 28th Day 2017


Julia is kind of rush the first day learning, and second day she usually learns more. Yesterday she learns like a monkey. Today she learns like a scholar. 

As a monkey style learner, she just quickly goes over as many articles as possible, and see if she can make some sense on any article first. Learn a few things first. 


Will come back later.

Sunday, November 26, 2017

Computer science graduate entrance exam study

Nov. 26, 2017

Introduction


It is my passion to help my nephew to prepare computer science graduate entrance exam in Dec. 26, 2017. What I did last 4 hours is to find out what I can help. I started the study around 7:00 pm and ended around 11:25 pm.

I like to look into the book called 王道数据结构全书。

Things I did in 4 hours study:


Call my brother and wechat talk over 6 times, each time I got ideas what to work on.

Find his weakness in the common testing courses
What will be helpful? More mock practice for example, math subject, English, and politics
Contact wechat group to ask help from computer professors
Get some tips for preparation
Look into on baidu.com and see what courses online
Study how to train a young person to deal with the stress

Chat with computer professor from China visiting in Florida as well.

As a matter of a fact, I could not reach my nephew through wechat or cellular phone. Being an aunt, the experience can be so challenging and so funny. It is not easy. 

Cordiva contest

Nov. 26, 2017

Plan to spend a few hours to work on the contest today. The contest already ended in Saturday.

The contest link is here.


Canada Immigration study

Nov. 26, 2017

Introduction



It was Saturday and my own free time. I devoted myself a few hours to study case by case about Canada immigration in hong kong office and understood the normal process.

I just took pictures when I found a good discussion about the case, and shared through wechat to my family small group. I also like to share around 10 pictures here. Later on, I will read again each topic and see if I need to look into more.

Bible teaching is very good on this, if you start to help others, then you also help yourself, enrich your own life.


Saturday afternoon half hour tour

Nov. 26, 2017

Introduction


It is the third time I tour the immigration and study consultation offices in crystal mall. There are over 5 offices in two floors, I like to get to meet people and then get more prepared to handle my own case to be a sponsor and help principal applicant afterwards.

This time I also ask about studying in Canada. To sponsor a twenty-three years old young Chinese with an undergraduate degree, I like to prepare myself to get to know more about education of Canada, therefore I can give out advice to a young relative.

Here are the offices I visit:

1. Ocean ventures education & Immigration Consultants Inc. Here is the website.
2. Canada starlight education group, www.viecanada.ca
3. Maple path consulting ltd

Plan to study the website www.yueyangvisa.com, it is a very good place to understand how Canada helps new immigrant. I already found a few good articles.

I had special thanks to consultants in the office of Maple path consulting ltd, I was really appreciated that they gave me good free consultation, and we had good conversation about the immigration application experience.



Saturday, November 25, 2017

Alexis Ohanian | Full Talk and Q&A | Oxford Union

Nov. 25, 2017

I was planning to go out to play tennis, and then I stopped for the video about Alexis Ohanian. I finished the 50 minutes video. Now it is 3:35 PM Nov. 25, 2017.

I like the talk and like to write down some notes about the talk.


The Undefeated In-Depth: Serena with common

Nov. 25, 2017

I have two hours left before it is getting dark in Vancouver. I need to go out to play tennis. Now I need to prepare a short lunch for myself, and I am in the middle of this interview. 47 minutes video from ESPN interview, called The Undefeated In-Depth: Serena with Common - Serena Williams 2016 ESPN interview

The video link is here. 

Being a sponsor the first time

Nov. 25, 2017

Introduction


It is tough topic to write as a sponsor first time. I went to Willingdon church service last Sunday and asked a sister in church to pray for my application last Sunday, it is in Chinese tea time, and Chinese sister is the first time I met, and so surprisingly the consultation was such a good story for me to share. I was touched and broke into tears. Being a sponsor to be, I think that it is right thing to do to prepare for my future and have a supporter in Canada.

It is so interesting to learn from opposite opinion. One argument is that the immigration is tough path for a young Chinese and there are more opportunities in China instead. More advanced developed country in China these days, a lot of things I should have looked into before I try to be a sponsor.

Unstoppable Sharapova 


I decided to review the video and studies more than three times. I noticed that the first time Sharapova's father's role in her growth, specially in her young age. The video link is here, 22 minutes. The video is produced by BBC NEWS. I was amazed that the talk among two people are so challenging and then interviewer was such a great questioner and Sharapova brought up so many good topics in the talk.

I will write down the topics I like most.





Authenticity is the key

Nov. 25, 2017

Introduction


It is the Saturday morning and I have to choose a few things to work on and one of things is to review the video called "Holding Serve with Maria Sharapova(TC)". The video link is here, 22 minutes. I need to work on coding blog, while I watched the video more than four times.

Authenticity is the key. I learn from tennis sports star how to deal with the up-and-downs, while I learned from the video, I decided to add contents to my blog.

Last Sunday, I went to Willingdon church service and also Chinese tea time after that. I stopped going Church last two years until this February I got involved in a car accident. I know that I lose the most basic skills to build a strong social support around myself, I involve too much with internet, not real person connections.

Holy spirit 


Last Sunday I had to go to church and seek some guidance on my sponsorship application process, I sent out the forms to add some additional information to immigration, and wonder what I can do if I get to work on more, should I consult an immigration lawyer to pay $300 an hour? Is that the path for me to take tooth to tooth, eye to eye.

This is the first time as a programmer I have to talk about holy spirit, as I always talk to my roommate Emma, a nonbeliever. Let us catch the holy spirit, because I am always late for the service, missing the choir and great performance, even though Emma just choose to stay in Willingdon church cafeteria instead sometimes or fall in sleep sometimes in services. I like to practice social skills in the big crowd specially after the service. I used to play card games over one hour with Chinese single group and I had chance to learn how the card game could benefit so well in next whole week full time work. The activity reminds me how normal week will start with a relax card game in Sunday.

Sometimes I could not relate to bible story in English while sitting in the santuory, often I get lost very easily. But I count the words I review in songs and preach, over 20 word each time. Definitely it is very good for me to expand my reading of English literature and help my writing as a blogger.

Most of time I do not spend time in Chinese tea time, I know that it is helpful for me to clear out my thoughts and doubts about preach in English, but it takes one hour and with a lunch. That kind of confusion is overall called holy spirit.

But last Sunday Chinese tea time, the teaching is related to Chinese murder case, I was so surprised and I did not want to blog it and try to make it a just normal Sunday. Make two new friends in the church and ask them to pray for my case, that is the way I get connected and get some support.

Learn from the interview


I have difficult time to make decision what to write and what to avoid, I am trying to make the blog easy and relax, avoid serious topic. Watching the video, I follow the flow of the interview and keep myself surprised how I approach those topics first time.

My Canadian sponsorship has been approved

Nov. 25, 2017

It is the short and unbelievable success news at the end of year. I got an email from Mississauga immigration center that my sponsorship is approved. Such a great news! I am so proud of being a lonely Canadian and be able to support a young relative to get his Canadian application processed.

Canada is the country I work so hard last eight years. I do not count on the material things, I like to work hard and help this country through my hard work.


So many thanks to the pray from the Willingdon church sisters last Sunday. I also learn from the preach last Sunday and understand that it is my task to help the young person develop resilience through up-and-down, stay mental strong and health as a sponsor. As a Christian, I love the failure and embrace every one of them and help myself to stay intelligent and hard working.

Friday, November 24, 2017

Leetcode 33: Search in sorted rotated array

Nov. 24, 2017

Introduction


Sometimes I have to push myself to be a good thinker instead of being a programmer, just think, no play with debugger, mock interview test cases, Leetcode online judge. I should think about basics by myself, for example, when I write depth first search, I should put base case first, evaluate edge case and leave it to myself, do not let Leetcode online judge remind me missing edge case.

Today I learn that Leetcode 33 online judge is a better tool, my two practice of the following neither passes the test case with given array [1, 3] and search value 3. 

I made two code reviews after Nov. 22 mock interview, both of them are buggy code. I found the issue through Leetcode 33 online judge later on. The following two sections are included with the detail.

Code review 1



Plan to spend 30 minutes to play with logic, Work with the conditions:

Here are my thoughts in plain English.

I like to make the code short and then I have more time to explain my idea in mock interview.

First argument:
Only check first half and see if the number is in the first half or not.

Assuming that the first half is in ascending order, then the number to search should be in the range of start and end value, otherwise the first half is not in ascending order, then start value is bigger than middle value. We can infer that second half range is in middle value to start value. We just need to make sure that search number is not in the second half range.

Here is the C# code passing all test cases. But actually the code has a bug by going through Leetcode 33 online judge.

I reviewed the code and found out that I break DRY - do not repeat yourself principal.

By going through the following logic, I found out that the logic can be simplified, need to get rid of checking called firstHalfAscending, but the code is wrong for second part circled in red color. It should be || not &&.

Actually the mock interview tool does not have good test cases, leetcode 33 online judge shows that the above code has failed test case, [5, 1, 3], 5

If the first half is not in ascending order, the logic checking is || not &&.

search >= startValue || search < middleValue

Code review 2


No more code smell, no more copy and paste. Binary search has two choices, one is to get rid of first half, or get rid of second half. Two recursive calls.

Here is the C# code, the code has the issue. If the first half is not in ascending order range, then one of boundary checked is ok then it is ok.

The above code passed all test cases in mock interview test cases, but it failed on Leetcode 33 online judge. The test case failed is [1, 3], 3.

Breath first search algorithm

Nov. 24, 2017

Need to code review two practice on breath first search.

First one is on Nov. 16, C# code is here.
Second one is on Nov. 24, C# code is here.

Code review 


Copy the idea from code review here.

C# code is here.

Thursday, November 23, 2017

As iron sharpens an iron, a friend sharpens a friend

Nov. 23, 2017

Introduction


Proverb 27:17 is my favorite verse, As iron sharpens an iron, a friend sharpens a friend. I used the bible verse very often to encourage my sisters last 2 weeks to get involved the community of sisters and brother as a whole and stay together after my mom passed away Nov. 11, 2017. I also like to use this encourage myself to stay in mock interview, always reach out others to help and share and work hard as a player as well.

I just created a new gmail account and started the fifth round of the interview on Nov. 22, 2017. I start from 6 mock interview credit. I have to work hard to gain more credit. Surprisingly, I met a veteran who has over 10 years experience, and also worked in Microsoft on Nov. 22, 2017.

New idea please! 


I have been worked on the binary search algorithm over 10 + 10 times, as interviewer and also interviewee since March 2017. This time, the peer asked me to clarify my code using a test case after I wrote the code. I understood that the peer did not understand my analysis and if that is the case then I should work on better presentation or make the code much easier to follow.

I need to do more work after my last mock interview on Leetcode 33 algorithm. This solution I practiced on Nov. 22 is exactly the same idea I did the previous mock interview on the algorithm on Sept. 16, 2017.

Code review: four sum algorithm mock interview practice

Nov. 23, 2017


Introduction


It is my favorite time to ask a question on code review website. I have practiced the mock interview on Leetcode 4 sum problem over 3 times since March 2017.

The code review is titled Four sum algorithm mock interview practice.

Will document some ideas to improve the question.

Follow up 


It is Nov. 25, 2017 1:13 PM, as a person to be responsible for my own question, I only got one up-vote and 80 views, and then stackoverflow does not share my question on twitter this time. I certainly know that my writing does not make a case for my title. Instead of after reviewing the writing more than 20 times, I rewrote in the following:

Whiteboard testing is savior  - it is tough topic to make some sense! 

Whiteboard testing is the tool in mock interview to show how I am responsible for my own code, be critical thinker. Being a responsible person, make a plan, and follow through the plan, that makes a person success. It does matter for the algorithm and data structure mock interview practice as well, follow through with a whiteboard testing to review and think one more time.
Recently, the peer asked me not to do whiteboard testing during the mock interview, because the peer was happy about my coding. After the mock interview I spent over one hour to using Visual Studio and tried to find one simple mistake to mix two variable names, actually the bug can easily be found in less than five minutes through the whiteboard testing. Through the instance I learn that the whiteboard testing is such a simple habit to build and a savior for me as a mediocre programmer. It should have saved me hundreds of hours through the career if I build the habit the first day as a programmer.


Writing is fun


Writing is like a tennis sports, you have to find ways to make it work. I posted the question and only got one up-vote, then I noticed that I have to work on more and express my intent more grounded. People are busy and no one can figure out what I try to talk about if I do not review very carefully. Try to avoid the ambiguity. The word savior in the title may not be  a good one, need to find one to replace the word. 

Here is the edit of 14th:

Algorithm professor website study

Nov. 23, 2017

Plan to study the website of a computer professor and learn somethings there. Recently Julia worked on the code review on Leetcode 4sum problem and she noticed that the professor gave the answer for k-sum upper bound. The link is here.


Leetcode 81. Search in Rotated Sorted Array II

Nov. 23, 2017

Plan to work on Leetcode 81 after I practiced Leetcode 33: Search a number in sorted rotated array.

Binary search is always my favorite

Nov. 23, 2017

Introduction


Binary search algorithm is my most favorite algorithm. I like to write it as a depth first search, recursive solution, and learn to write base case as the first thing in the function.


Code review 


Here is the C# code I wrote tonight. The mock interview started from 10:00 PM.

But the code smells, do not repeat yourself. DRY principle is violated.


The above code could not pass Leetcode 33 online judge, failed test case: [3, 1], 3, since the left half range can only include one node, so the fix is to include = sign in statement line 35.

Instead of "var firstHalfAscending = startValue < middleValue", it should be "var firstHalfAscending = startValue <= middleValue".

Follow up

Nov. 23, 2017

After the mock interview, I thought about my solutions in past practices. I should find a more simple solution.

In mock interview, peer asked me to explain the idea again to divide into two half range, one is in ascending order. I failed to make the idea very clear to a veteran programmer working over 10 years in Microsoft.

In other words, my code smells. Because I used the copy and paste in the mock interview, there are four recursive calls instead of traditional two recursive calls for binary search algorithm.

Based on the mock interview standard answer, it is to find pivot point first, and then apply binary search algorithm. Instead I applied binary search algorithm directly without concerning the pivot value.

Why? How did I make the different choices?

Of course, I spent hours to read all kind of solution on discussion panel of leetcode 33: Search in sorted rotated array before. I knew that there are almost millions of submissions, so many ideas. But bottom of my heart, I like to say that I went through mathematical training of analysis, I like to introduce two lemmas before I write code.

Lemma 1


The sorted array with length bigger than one is rotated to left with unknown n numbers, given the number n, n can be determined in the first half by the following checking:

Based on the fact that the first half range's length is not smaller than one.

How to determine if n can be searched in the first half range?

If the range is in ascending order, in other words, array[start] <= array[middle], and if n is in the range of [array[start], array[middle]], then n will be in the second half. Get rid of second half.

If the first half range is not in ascending order, then at least there are two elements in the first half range. It can be inferred that second half range is [array[middle], array[start] - 1]. The search number n is not in the second half range. Either the search number n is not smaller than array[start] or n is smaller than array[middle].

End of Lemma 1


One good solution with example



The C# code is here:

Here is the example to explain one inclusive range or two exclusive range to search:

More detail, exclude the range [4, 8] which is in ascending order in the above picture, two ranges are checked, one is >= 9 and the another one is < 3.



Nov. 24, 2017

Continue to update the code, use more meaningful variable names. C# Code is here.



How do I get here?


I have to get organized, so I went through blogs and reviewed all past practice on this algorithm, and also checked leetcode 33 submission history. I did not submit anything on Leetcode 33 before Nov. 22, 2017.

Past experience is documented here.

Sept. 16, 2017

The mock interview practice is documented here.


March 23, 2016

The practice is documented here.

Nov. 23, 2017

Leetcode 33, Search in Sorted Rotated array, C# code passes online judge.

Tuesday, November 21, 2017

Leetcode 69. Sqrt(x)

Nov. 21, 2017


Introduction


It is the algorithm to apply binary search and also relate to math round of a number given the error range, the algorithm is similar to easy level algorithm called Leetcode 69, Sqrt(x).


Algorithm review 


Julia spent first 30 minutes to work on the algorithm analysis and wrote code. Afterwards, the peer helped Julia to find bugs to make sure all test cases are passed.

Here is C# code submission with bugs.

Here is C# code submission after discussion of issues causing bugs. The code passes all test cases.


Highlights of discussion


It took almost three hours for Julia to discuss with the peer how to solve the algorithm and data structure problems. The mock interview had some technical issue, so the additional tools are used. One is for vidoe, https://appear.in and the other one is for editing, http://collabedit.com/. The mock interview started from 10:05 PM and ended around 1:15 am next morning.







Monday, November 20, 2017

Code review: Reusable implementation of IComparable

Nov. 20, 2017


Plan to study the code review, the algorithm is called Reusable implementation of IComparable<T>.

3D surface area - week of code 35

Nov. 20, 2017

Introduction


It is the first medium level algorithm in the week of code 35. The end time was 11 PM pacific time, I could not make it. Around 11:10 pm, only 10 minutes later, I submitted the code with a bug fix to pass a few test case. I enjoyed the problem solving, and will look into how to find the simple approach, less time consuming.

Code submission after the contest


Here is the C# code submitted after the contest, just 10 minutes after the deadline. Julia spent over  2 hours to work on the algorithm. The code passed 11 test cases, failed 14 test case, score 7.8 out of 19.


Triple recursion - week of code 35

Nov. 20, 2017

Triple recursion is the second easy algorithm in week of code 35. It only took Julia less than one hour to solve the problem.

Here is the C# code.


Sunday, November 19, 2017

Lucky purchase - week of code 35

Nov. 19, 2017

Introduction


It is the first easy algorithm in week of code 35. The problem statement is here.

The code submitted in the contest is here.

A bug 


I spent over one hour to work on the algorithm, my first two submissions could not solve test case 4 and 5. And then I went over problem statement again and again, read aloud one word a time in the problem statement and then had an idea to fix the bug issue.

If the char is not digit, then it should be ok. Only the digit char should be 4 or 7.


Sponsor application project (III)

Nov. 19, 2017

Introduction


It is the first time I like to document how I think my sponsor application project, and apply bible teaching to my daily problem solving activities. This Sunday I spent over 3 hours in Willingdon church, and I like to do some research, and see how bible will teach me this Sunday, how can I apply the learning to my current problem solving.

Bible teaching in Sunday service 


The preach is about Peter I.

Followed up in Chinese tea time


Relate to Christian how to handle the difficult time.

To my surprise, in Chinese tea time, I was told to relate to the case of murder case back to 1991, more than 26 years ago. I spent hours to study and review the case as a Christian believer, and understood the life purpose.

Sometimes in the church of Willingdon church, I enjoy the time to listen English preach, and then I spend some time to learn the preach again using Chinese. Through comparison, I surprise that I miss a big portion of preach since language barriers.




Saturday, November 18, 2017

Week of code 35

Nov. 18, 2017

Plan to play week of code 35 starting this Saturday. I am getting excited on the contest.

Nov. 19, 2017

6:53 PM
I only have 4 hours available for the contest, I started to work on the contest this 4 PM today. Yesterday I only spend one hour to read the advanced level algorithm.

Motivation


To work on crafting skills, I learn to work on contest at least a few hours each time. Today I will have at least 4 hours to work on coding, one of biggest achievement is to find my weakness through coding.

Statistics 


Time to work on contest from 4:00 pm - 11:00 pm. 7 hours is not enough for Julia to complete first three algorithms, she did not even have time to read hard level algorithm problem statement.

First easy algorithm, Lucky purchase, 4:25 PM - 5:37 PM, with a bug, and then spent extra 20 minutes to fix the bug.

Second easy algorithm, Triple recursion, 7:34 PM - 8:03 PM. The algorithm passed all test cases.

Third algorithm, medium level one, 3D Surface Area, 9:33 PM - 11:07 PM. I could not finish code before 11 PM. The contest ended at 11:00 PM.


Comparable Interface lecture notes

Nov. 18, 2017

Introduction


I have chance to go over the lecture notes called Comparable Interface, and I like to share my review of lecture notes, how good it is for me to learn things after over 10 hours practice on Comparable Interface. The lecture note is here.

The course outline is here.

Course study

Plan to read the course lecture notes and write down some note here later on.



Code review: Dynamically sorting with IComparer

Nov. 18, 2017

Introduction


One of challenges is to ask a good question on code review. As an experienced code reviewer, I certainly understand that Order Strings should be a good candidate for my next question I try to find last few days. Even though I spent over 10 hours to practice Order strings algorithm and got a lot of training, but I still knew that I need to be mentored. One thing is to look into previous code review on IComparer.

Code review study


Dynamically sorting with IComparer


What is Int32 in C#?

Nov. 18, 2017

Introduction


Learning by myself is such a great journey, I had a best world interview in the world this October to be tested how good I understand the object-oriented programming. I know that I am kind of weak, I have no clue to figure out my weakness from senior level programmer in well-founded biggest company. I try to dodge questions but I know one day I have to catch up.

I need to read Int32 C# source code. How do I find time to read the code and get the idea? I was so busy with my full time work and learning by myself. So many things to do, how do I have a clue to study this and break through the foundation of learning object-oriented programming.

Order Strings


I played the contest and wrote a partial sorting algorithm called Order Strings. Followed up hours of study code submission, over 10 C# submission with full score, I reviewed the code and wrote Order String Series blogs about the practice. But I still felt that I need some more coaching. 

Code review study

I found the best code review about IComparer. Because this statement is telling the fact, but I never know that.






Sort algorithm on Leetcode

Nov. 18, 2017

Introduction


Sorting is most basic algorithm in computer science. Here is the list of sorting algorithm on Leetcode and I like to review them.

On Nov. 15, 2017 10:00 pm, I practiced sort algorithm and my peer is a Chinese with over 10 years programming experience in USA. The peer gave me the excellent code review and made some great comments.

Let us first take a look at the overall evaluation. C# code is here.

So and So


It is my evaluation of coding on a sort algorithm. Things you should work on: No clear thought, messy coding. Here are the code review I got:


Transition from bottom up to top down


I went through bottom up approach to write a functionality of findMaxIndex by the help of whiteboard test with a simple test case: [1, 5, 4, 3, 2], I explained to the peer that I like to find index of max value of the array 5 first, and then second step is to move 5's position to the first element in the array, and then move first position to the last position of the array using flip API twice.

The peer complained that what is line 38 and line 39, it can be written as swap(arr, maxIndex + 1, subArrayLength). If you have time, then you can write the function, ask the peer if you should write the function or not, basically two flip calls. 

Same story applies to line 24 to line 36.

The small research I have to do is to figure out if top-down approach is really great and I should learn. When I do not have clear solution for the algorithm, I often choose the bottom-up approach, use a simple test case to do whiteboard testing, write a working solution first. And then add on the solution. But I should not stop, need to add review, use top-down approach to extract functions, make meaningful names.

CountFound variable is not meaningful, it is better to use subarrayLength.

Argument today


You can not hide what you do at work, if you code messy at work then you will show up messy in mock interview.


Friday, November 17, 2017

Linkedin 950 connections study

Nov. 17, 2017

Introduction


One of my most favorite activities is to review my connections on linkedin at the end of 2017. Over one hour, I went over connections by shared connections and tried to collect some statistics, and see how my friends make their career movement, how they advance their career.

I started to see how many of them moves to Amazon, and then went over others and found out what kind of jobs they change.

Now it is 11:48 PM, I started from 10:00 PM. I started to 10:00 PM since I believed that I booked the mock interview, and then I toured LinkedIn and just got lost in those connections.

What to study 


I have over 900 connections, first I went over my messages history last 12 months and found out over 90 mock interviewers's update. So surprisingly, a few of them got jobs in Facebook (2), Amazon (4+), and Microsoft (2+). I checked their job history and understood how they are selected. Some of them have solid work experience through last job, over 4 years, well-established companies.

The list of companies I looked up are Microsoft, Google, Apple, LinkedIn, Amazon, HP, ITW, Oracle, Sony, Intel, Motorola, Florida Atlantic University, etc. I added some friends through mock interview, and started to learn how new generation of people work compared to my old friends, from Intel, Intuit, Cisco, Qualcom, etc.






Wednesday, November 15, 2017

Binary tree root to leaf path minimum path value with the path

Nov. 15, 2017

I like to document my mock interview practice on this algorithm. The topic is about analysis of the algorithm, how to reason to find possible bugs?

Here is C# practice code.  I added line 27 to line 32 to fix the bug since the peer told me that the edge case with no children. The advice from the peer is "After writing the code need to analyze more before running it". 


Story of analysis


I need to explain how the depth first search works since peer asked if I should add an argument of function to pass the existing value. I did explain the algorithm in the mock interview, but the peer felt that he did not know C# very well and got confused. 

I like to write my story to show how I analyze the algorithm after the mock interview, try to make the explanation to a very good one. 

Let us go over  a tree with the following nodes:

      0
  /   |   \
 4   3   6
 /
3

The depth first search algorithm can be solved this way. The root node with value 0 has a tree, to find its minimum path to the leaf node, first if the root node is null, then value is 0; if the root node is not null, and if the root node has no children, it is a base case, the minimum path is the value of root. Otherwise, go over each children of root node with value 0, and go to each child in the array [node 4, node 3, node 6], and ask each node to get its minimum value for the path, denoted as Mi, and just add root node value 0 to Math.Min(Mi, i from 0 to 2).


Miss a base case


From the above paragraph, I highlighted the base case I missed in mock interview using brown color, and the peer had to tell me that there will be a problem if there is no children. In other words, in the tree showing in the above diagram, if the root node with value 0 has no children, it is a base case, the minimum path is the value of root.


Order string (VII)

Nov. 15, 2017

I like to write a blog about this C# practice, using Linq IList.Sort method. The link is here.

Order string (VI)

Nov. 15, 2017


Algorithm Study and Code Review


Here is the code related to the algorithm. I like to write a blog on the code. The main idea is to use primitive type string, just add index to the first element of string array, avoid a struct or a class definition. Kind of tricky. 


Follow up study 

Nov. 16, 2017

It is always a good idea to search code review to read IComparable<T> code review. I sepnt over 20 minutes to read the algorithm: Dynamically sorting with IComparer. And one of statement in the code review reads like the following:

This
public int CompareTo(ProductSortAttribute other)
{
    if (this.Index == other.Index)
    {
         return 0;
    }

    if (this.Index > other.Index)
    {
         return 1;
    }

    return -1;
}
can be shortened to
public int CompareTo(ProductSortAttribute other) {
    return this.Index.CompareTo(other.Index);
}
Since Int32 also implements Comparable<T>.

What is Int32?



Here are a list of things Julia starts to her independent study:
1. What is Int32? A structure
2. What interfaces does Int32 implements? IComparable<T>, IFormattable, IConvertible.
3. Where is the source code of Int32 in mscorlib? Link is here.

Comparable <T>  study



Sometimes, it is so easy to find an excellent lecture notes, and then I can follow quickly how to write basic comparer. Here is the one.