CSI 2101 Study Guide - Quiz Guide: Liquid Oxygen, Gaussian Elimination, Eulerian Path
21 views6 pages
9 Oct 2021
School
Department
Course
Professor
Document Summary
This solution is prepared by the professor for use of students enrolled in the course in the winter 2017 and has copyright. No part of this document may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording or otherwise without prior written permission from the instructor. Program correctness, recurrence relations, and graphs: (10 points) consider the following piece of program that we call prog intended to compute the product of m and n: 11. a=0; b=n; c=m; while (b>0) do { if (b mod 2) = 0 then { b= b div 2; c = 2*c; else { a=a+c; b=b-1; q=a; Prove that at the end of the program the value of q is n*m, using the following steps. Assuming r is true, we know that m, n z, m 0 and n 0.