Gitesh Gupta
BAN USERwe need not divide by X,as we do not know all terms will contain X,some may be constants as well,we can add like terms together and push on stack in the form AX+B,so we will end up with such term in the end,which can be solved by taking all constants on one side and dividing by coefficient of X
- Gitesh Gupta February 18, 2013if there is only X i.e one degree expression,then you can use 2 stacks here,
Stack 1: for keeping all the operators
Stack 2:for keeping terms
keep pushing data to stacks,when you hit a left parenthesis (")"),pop 1 element from stack 1 and 2 elements from stack 2,then apply the operator to the terms and push the result again on the stack..you will end up with a simple expression in X that can be solved easily..
This wont work either,you are just checking for consecutive triplets..ex {0.1,0.2,0.3,0.4,1.4}.your solution will return false but there exists a triplet i.e {0.1+0.4+1.4=1.9<2}
- Gitesh Gupta February 18, 2013
finding nearest neighbor to a point using kd trees (application of binary trees)
- Gitesh Gupta May 24, 2013