Re: is this NP-Hard?



On May 3, 3:00 pm, Kai-Uwe Bux <jkherci...@xxxxxxx> 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
.