The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago, 2 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
1. a. Identify the preconditions for the sequential search as represente. Establish a loop invariant for the while structure in that program that, when combined with the termination condition, implies that upon termination of the loop, the algorithm will report success or failure correctly.
b. Give an argument showing that the while loop does in fact terminate.
2. Based on the preconditions that X and Y are assigned nonnegative integers, identify a loop invariant for the following while structure that, when combined with the termination condition, implies that the value associated with Z upon loop termination must be X – Y.
Z ←X;
J ←0;
while (J < Y) do
(Z ←Z – 1;
J ←J + 1)
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------sol-----------uti-----------on.-----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- ca-----------tch-----------