Created
July 14, 2018 19:49
-
-
Save jianminchen/d54d18ad52cfabba07cab9a3adc19fb2 to your computer and use it in GitHub Desktop.
30 minutes mock interview feedback - July 14, 2018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use infix expresssion to construct binary expression tree | |
My feedback after the performance of 30 minutes of the peer: | |
Leet us to work on a simple infix expression and see how we can solve the problem together. | |
Given infix expression (1+2), we like to use stack to construct the binary expression tree. | |
First all elements in the expression are pushed to the stack until close bracket is met. | |
Here are the steps: | |
infix expression: (1+2) | |
create a stack, | |
( -> to the stack | |
1 -> to the stack | |
+ -> to the stack | |
2 -> to the stack | |
------), we need to pop stack four times to get two operands, one operator, one open bracket. | |
let get number operand 1 : 2 | |
get operator : + | |
get operand : 1 | |
get open brakcet ( - match - expression is wrong | |
And then a binary tree construction here: | |
you can do - create a node for + | |
put left child and right child to + | |
put node for another stack for binary tree stack -> bottom up | |
() out of control to help you to parse -> | |
four operations -> | |
Similar algorithms to relate to: | |
Leetcode 301 - > () bracket, invalid bracket, I studied over 10 solutions -> | |
Need to write something for 30 minutes performance | |
The peer said that he may fail because he could not write a completed solution. Even though he has optimal solution based on | |
time complexity and also use stack - know how to use data structure to get optimal time complexity. | |
Detail cannot be finalized in 30 minutes time range. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment