From: Kai-Uwe Bux on 3 May 2010 06:00 Talha Lateef wrote: > I am thinking of creating a tree with temp Result in each node, each > node has five childs {+,-,*,/,.}, if temp result of a node is greater > than my Result then i will stop calculating that branch. But would that be justified? It appears that / or - can later decrease the result. So, if you had S = { 1, 2, 3, 4, 7 } R = 2 (1+2+3) / (7-4) = 2 would do it, right? But in the evaluation, there are many subtrees that evaluate to something bigger than 2. Best Kai-Uwe Bux
From: Talha Lateef on 3 May 2010 08:14 On May 3, 3:00 pm, Kai-Uwe Bux <jkherci...(a)gmx.net> wrote: > Talha Lateef wrote: > > I am thinking of creating a tree with temp Result in each node, each > > node has five childs {+,-,*,/,.}, if temp result of a node is greater > > than my Result then i will stop calculating that branch. > > But would that be justified? It appears that / or - can later decrease the > result. So, if you had > > S = { 1, 2, 3, 4, 7 } > R = 2 > > (1+2+3) / (7-4) = 2 > > would do it, right? But in the evaluation, there are many subtrees that > evaluate to something bigger than 2. > > Best > > Kai-Uwe Bux Excellent point Kai-Uwe i was just about to start coding data structures, i was doing this because i would like to reduce work of this brute-force approach, as you can see the nodes will increase 5 times in next level, i will rethink my strategy. thanks
First
|
Prev
|
Pages: 1 2 3 Prev: Young girls showing off their bodies on personal webcams Next: Style (was Re: on goto) |