c You have a program that outputs the message “illegal input record” when fed a
ID: 3623383 • Letter: C
Question
c You have a program that outputs the message “illegal input record” when fed a certain file of input records. You know that processing of each record is independent of the other records. You want to discover what record is illegal.
d.You have three jugs, measuring 12 gallons, 8 gallons, and 3 gallons, and a water faucet. You can fill the jugs up or empty them out from one to another or onto the ground. You need to measure out exactly one gallon.
(Artificial Intelligence: A Modern Approach, 3rd Edition. Prentice Hall/CourseSmart, 12/01/2009. p. 114).
Explanation / Answer
c. Initial state: Considering all input records.
Goal test: Considering a single record, and it gives “illegal input” message.
Successor function: Run again on the first half of the records; run again on the second half of the records.
Cost function: Number of runs.
State is the number of records n. Initial state: n =0. Goal state: the program does not output “Illegal input record” when the first n records are given to it. Successor function: increment n. Alternatively the successor function could do binary search if the maximum value for n is added to the state.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.