Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Knuth's dynamic programming algorithm: Mehlhorn's approximation algorithm[edit] While the any time taken by Knuth's algorithm is substantially better than the exponential time required for a
Knuth's dynamic programming algorithm: Mehlhorn's approximation algorithm[edit] While the any time taken by Knuth's algorithm is substantially better than the exponential time required for a brute-force search, it is still too slow to be practical when the number of elements in the tree is very large. In 1975, Kurt Mehlhorn published a paper proving that a much simpler algorithm could be used to closely approximate the statically optimal tree in only time.[3] In this algorithm, the root of the tree is chosen so as to most closely balance the total weight (by probability) of the left and right subtrees. This strategy is then applied recursively on each subtree. That this strategy produces a good approximation can be seen intuitively by noting that the weights of the subtrees along any path form something very close to a geometrically decreasing sequence. In fact, this strategy generates a tree whose weighted path length is at most where H is the entropy of the probability distribution. Since no optimal binary search tree can ever do better than a weighted path length of 1.Explain binary search tree properties and operations involved in it. explain AVL tree properties and rotations with examples. What are splay trees 2. The LALR(1) parser is less powerful than the LR(1) parser, and more powerful than the SLR(1) parser, though they all use the same production rules. The simplification that the LALR parser introduces consists in merging rules that have identical kernel item sets, because during the LR(O) state-construction process the lookaheads are not known. This reduces the power of the parser because not knowing the lookahead symbols can confuse the parser as to which grammar rule to pick next, resulting in reduce/reduce conflicts. All conflicts that arise in applying a LALR(1) parser to an unambiguous LR(1) grammar are reduce/reduce conflicts. The SLR(1) parser performs further merging, which introduces additional conflicts. S->BB B->aB B-> LALR or not.clear draw all states and mark equal states cleary, draw LALR parsing table. 3. E->A/(E) A->+E] *E | epsilon Write about predictive parser and its components. decide above grammar is LL(1) or not. draw parsing table and first and follow sets clearly. parse string 'ata
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started