CSC 236 , Summer 2005 , Assignment 2 sample solution
نویسنده
چکیده
Proof (complete induction on n): If n = 0, then P (0) asserts that there is f(0) = 1 distinct output starting with an empty string. This is certainly true, since the unique empty string is output, so the base case holds. Induction step: Assume that P (f0; : : : ; n 1g) is true for some arbitrary natural number n. I need to prove that this implies P (n) is true. If n = 0 there is nothing to prove, since this was veri ed in the base case. Otherwise the IH assume P (i) and P (n 1 i) for every 0 i n 1. WLOG, assume that the rst character of the original sequence of length n is the character x, and partition the output sequences according to where x occurs in the output | at position i of the output, where 0 i n 1. This partition counts all possible outputs, and has no duplicates, since a particular output is speci ed by the position of the character x. Since this is a LIFO stack, the i characters that are output before x, in positions f0; : : : ; i 1g, must have been pushed onto the stack after x was pushed, and popped from the stack before x was popped. Thus these characters are the next i characters pushed following x in the original sequence, that is characters f1; : : : ; ig of the original sequence. Since they are pushed and
منابع مشابه
Rapid Extraction of Plutonium from Urine by Pyrosulfate Fusion and PERALS Spectroscopy
Rapid Extraction of Plutonium from Urine by Pyrosulfate Fusion and PERALS Spectroscopy R.L. Metzger, P.H. Pouquette, and G.W. Klingler Radiation Safety Engineering, Inc. Chandler, AZ Abstract To effectively treat accident victims exposed to airborne isotopes of Plutonium, chelation therapy must be started before the Plutonium is fixed in bone. Urine bioassay samples must be processed rapidly af...
متن کاملCSC236, Summer 2005, Assignment 3 Sample solution
Solution: I'd like to have bToTheP equal to bp when the loop exits, so I prove the following invariant: Claim 1a: Let P (j) be \If there is a jth iteration of the loop of pow then bToThePj = bij and ij = j." I claim P (j) is true for all j 2 N. Proof (induction on j): Suppose j = 0. Then (by the program) bToTheP0 = 1, i0 = 0, so bToThePj = 1 = pij , and the base case holds. Induction step: Assu...
متن کاملCubic Sieve Congruence of the Discrete Logarithm Problem, and fractional part sequences
The Cubic Sieve Method for solving the Discrete Logarithm Problem in prime elds requires a nontrivial solution to the Cubic Sieve Congruence (CSC) x ≡ yz (mod p), where p is a given prime number. A nontrivial solution must also satisfy x 6= yz and 1 ≤ x , y, z < p, where α is a given real number such that 1 3 < α ≤ 1 2 . The CSC problem is to nd an e cient algorithm to obtain a nontrivial solut...
متن کاملConceptual Set Covering: Improving Fit-And-Split Algorithms
Many learning systems implicitly use the fit-andsplit learning method to create a comprehensive hypothesis from a set of partial hypotheses. At the core of the fit-and-split method is the assignment of examples to partial hypotheses. To date, however, this core has been neglected. This paper provides the first definition and model of the fit-and-split assignment problem. Extant systems perform ...
متن کاملCPE/CSC 480-F05 Artificial Intelligence
Invoke the Constraint Satisfaction applet, and load the sample "Five Queens Problem". Look at the graph displayed, and determine the relationship between the conventional representation of the queens problem on a chess board, and this one. Then use the tool to solve the problem. You can do this either in "Auto-Solve" mode, or manually: Select values for a variable, and then let the tool calcula...
متن کامل