@ritesh..you dnt have to output v.. you have to output the minimum number of flips so that your tree evaluates to v(v is either 0 or 1) and if it alreday evaluates to v then return 0(no flips required) if not possible return -1
On Wed, Aug 4, 2010 at 12:11 AM, RITESH SRIVASTAV <riteshkumar...@gmail.com>wrote: > level of the tree is given or not ? > and where do we have to output V , just at the node we get it or at > the root ? > > On Aug 3, 1:56 pm, jalaj jaiswal <jalaj.jaiswa...@gmail.com> wrote: > > given a complete binary tree (either a node is a leaf node or has two > > children) > > every leaf node has value 0 or 1. > > every internal node has value as the AND gate or OR gate. > > you are given with the tree and a value V. > > you have to output the minimum number of flips (AND to OR or OR to AND) > if > > the evaluated value is not equal to V, if it is equal return 0, if not > > possible return -1. > > you can just change the value of internal nodes i.e can make and to or , > or > > to and to get the desired output > > give the minimum number of flips required to get the desired output. > > > > -- > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.