You are on page 1of 1

Link to the exposition: ​https://youtu.

be/D76w8EDssgM 
 
Aids used in exposition: 
 
changeXY(String str) ​body: 
 
1) Checks if the string contains “x”s. 
2) If so, replace the “x” found with a “y” and go to step 1. If not, check step 3. 
3) Return the string. 
 
calling​ ​changeXY("xxhixx") →​ "yyhiyy"

S T A R T    F I N I S H 
 
changeXY( )​ changes   
"xxhixx​" to "​ yxhixx"​ and  The first call returns the 
passes it to   value a final time and now it 
changeXY(str)  can be used 

changeXY( ) ​changes  ^ 
"yxhixx"​ to ​"yyhixx​" and  ^ 
passes it to   ^ 
changeXY(str​)  (Previous call) 

changeXY( )​ changes  ^ 
"yyhixx"​ to​ "yyhiyx"​ and  ^ 
passes it to   ^ 
changeXY(str)   (Previous call) 

changeXY( )​ changes  ^ 
"yyhiyx"​ to ​"yyhiyy"​ and  ^ 
passes it to   ^ 
changeXY(str)   (Previous call) 

changeXY( )​ finds no “x”s  ^ 


in "​ yyhiyy"​ and ​returns it    ^ 
------>  ^ 

You might also like