English
Tamil Nadu Board of Secondary EducationHSC Science Class 11

Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink and glass B is full of grape drink. For exchanging the contents of glasses A and B, represent - Computer Science

Advertisements
Advertisements

Question

Exchange the contents: Given two glasses marked A and B. Glass A is full of apple drink and glass B is full of grape drink. For exchanging the contents of glasses A and B, represent the state by suitable variables, and write the specification of the algorithm.

Short Note

Solution

The specification of the algorithm:
exchange (A, B)
–inputs: A, B are real and >0
–outputs: A, B are real and >0
State representation
TEMP:=A
A:=B
B:= TEMP

shaalaa.com
Algorithm Design Techniques
  Is there an error in this question or solution?
Chapter 6: Specification and Abstraction - Evaluation - Section - D [Page 87]

APPEARS IN

Samacheer Kalvi Computer Science [English] Class 11 TN Board
Chapter 6 Specification and Abstraction
Evaluation - Section - D | Q 3. | Page 87
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×