Hi guys,

I have a problem with the following syntax:

T -> T , k , T
T -> nil
T -> number

This is a BNF rule for binary trees. Assuming that nil and number are tokens, I need to remove the ambiguity of this grammar without restricting the structure of the Binary Tree. Note that the two recursive refrences to T should remain; in the first rule.

I really couldn't solve this problem. Who can help me?! ;)

Recommended Answers

All 6 Replies

No ONE can answer this?!! :mrgreen:

>No ONE can answer this?!!
You can't answer it, why should you expect anyone else to? Anyway, have you tried something along these lines?

T ::= T, K, T |
      nil

Or were you just waiting on someone else to do your research for you?

I think it's a wee bit unfair, if he knew how to solve it, he wouldn't put the question. I find it quicker to solve a question then to get on the computer and type it. Beside, the fact that some studentd expect other people to solve their home work doesn't mean that all the students are the same !

>I think it's a wee bit unfair
Life isn't fair. Deal.

>the fact that some studentd expect other people to solve their home work doesn't mean that all the students are the same
I don't recall ever saying that they were. But the majority that come crying to us for help are, which is why I savor the very rare student that actually cares about learning and has an honest problem and a good question about it.

what ru talking about?!
It's not a homework!! It's just a problem that we discussed with some professor and he asked if we can solve it or not. I tried my best but I couldn't, if you donno how to solve or u don wanna solve it, please don't write anything in the thread :) Because it's out of your range :D

>It's just a problem that we discussed with some professor and he asked if we can solve it or not.
That sounds a lot like homework to me. Just because you aren't being graded on it doesn't mean that begging for the answer is a valid solution.

>I tried my best but I couldn't
What did you try? Trying your best is a very vague measure. In fact, I've helped people who thought that trying their best was posting a request for the complete solution on a forum like this one. I've been doing this for a while, and as you can imagine, it gets tiresome seeing the same thing over and over:

Hello, here is my problem: <Insert problem here, usually a direct copy of the homework assignment or similar>

I tried really really really hard to solve it, but I couldn't come up with anything. <Notice the lack of detail about what was tried>

So since I can't do it, why don't you do it for me? Then I can change it around a lot to make it look like something I'm capable of so I can palm it off as my work.

Thanks in advance for being a dumbass and hurting me down the road by giving me something that I should figure out on my own.

>if you donno how to solve or u don wanna solve it
I do, and I did. If you took the stick out of your ass and chilled out then you would see that I gave you a valid suggestion amid the annoyed comments about your ability to research problems.

>Because it's out of your range
Yes, it's sooo out of my range. :rolleyes: Tell me, who was asking the question and who was answering it? Let's see, you and me, respectively.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.