Question: 1 . Calculate denotational semantics for the following nondeterministic programs.a . LetS = ifx > yx = = x - 1 0 x > yy
Calculate denotational semantics for the following nondeterministic programs.a LetS ifxyxxxyyyxyxyx xyx:xy fi and let o x y Calculate MS o and show your work.b LetW dox y xxxyyyxyxyx xy x:xy od and let o x y Calculate M Wo and show your work.
Let b be an array of size n and VO i n bli v bil Decide which number or is the majority in b without counting their quantities.Write a program named MAJORITY in our language that can solve the above problem and bind the majority among and to variable major. You can assume that b is written in the memory state; and to simplify thequestion, we artificially define b n so you don't need to worry about a possible runtime error when thearray index reaches n Your program doesn't have to be deterministic. Be careful of the grammar in our programming language.Here are some hints: We can use the following linearsearchlike algorithm: scan the array b to pair up each with a Once we have some s left over, then is the majority; once we have some Os left over, then O is the majority; if we can pair up all numbers, then either of them can be the majority A student Jason wrote a partial solution that can be useful to solve the above problem: dobkol ko: kobkkkodConsider ko and ky as pointers for number and respectively. What program J does is to find the nextko and ky such that bkol and bkil You can use f inside of your program.
True or false. Justify your answer briefly.a If MSo contains exactly one state, then S must be a deterministic statement.b Ifo pS then o EpC If o #tot pS then o # pd Ifo F pS q then MSo Fqe Ifo # pSa then o #tot p S q
Let predicate function Pk s s k s For each of the following triples, decide whether it is validunder total correctness, justify your answer briefly.aPks s PksbPk ss s Pks cPk ss s: s ;k: kPksdPks Ms Sos sPk soePk s :s ;k: kPks
Answer the following questions and justify your answer briefly.a Leto Fx # while x # dox: x odx what are the possible values of oxb Leto Ftot x # while x # do x : x od x what are the possible values of o x
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
