Extend the parser of the case study so that it both parses and evaluates expressions.
An interpreter not only parses expressions for their syntax, but also evaluates them to determine their values. Extend the parser of the case study so that it both parses and evaluates expressions. The only change to the user interface is that the output contains the value of the expression if that expression is syntactically correct. […]
Define a function insert that expects an index, an item, and a Lisp-like list as arguments.
1 Sandra has a bright idea: When the length of a sublist in quicksort is less than a certain number—say, 30 elements—run an insertion sort to process that sublist. Explain why this is a bright idea. 2 Why is merge sort an O(n log n) algorithm in the worst case? 3 What is meant by […]
Discuss the trade-offs between Lisp-like lists and Python lists, including space/time performance and ease of verification.
1 Discuss the trade-offs between Lisp-like lists and Python lists, including space/time performance and ease of verification. 2 In the Case Study for Chapter 14, we developed a program that used a stack to evaluate postfix expressions. That program assumed that the user entered syntactically correct postfix expressions and made no attempt to parse them. […]
Sketch the load characteristics, terminal voltage/load current, of the following types of DC generator
1. (a) Sketch the load characteristics, terminal voltage/load current, of the following types of DC generator: (i) series-connected, (ii) shunt-connected and (iii) compound-connected. (b) State one purpose for which each is used. 2. Sketch the current/torque and speed/torque characteristics of series, shunt and both types of compounded DC motors. Suggest a suitable use for […]
what happens if the resistance in series with the shunt field of a DC motor is increased in value
1. Sparking at the trailing edges of the brushes in a DC machine is usually prevented by fitting (a) copper gauze brushes (b) a compensating winding (c) a compound winding (d) commutating (or inter-) poles 2.A series-excited field on a DC machine is connected (a) so that it carries the full machine current (b) […]