To more easily understand the meaning of the algorithm is exemplified a problem of exchange of contents of two glasses. Given two glasses A and B, A glass contains tea water and glass B contains coffee water. Interchange the contents of the glass so as to produce glass A which originally contained tea water to contain coffee and glass B water that originally contained coffee into tea water.
Look at the image below:
How to fix:
To exchange the contents of the glass correctly, an additional glass is called glass C as a temporary shelter.
Here's the algorithm:
- Prepare a backup glass C
- Pour tea water from glass A into glass C
- Pour coffee from glass B into glass A
- Pour tea water from glass C into glass B
Similarly this article.
Sorry if there is a wrong word.
The end of word wassalamualaikum wr. wb
Referensi :
- Ebook Logical and Algorithm
Jika ingin bertanya secara privat, Silahkan hubungi no 085709994443 dan untuk berkomentar silahkan klick link di bawah ini 👇