Stable marriage problem: Difference between revisions

Content added Content deleted
Line 5,426: Line 5,426:


=={{header|REXX}}==
=={{header|REXX}}==

{{improve|REXX| <br> this REXX program makes use of the '''repl''' BIF (or function), <br> but no such function is included in Classic REXX. <br> }}

Algorithm used: see link https://www.youtube.com/watch?v=Qcv1IqHWAzg
Algorithm used: see link https://www.youtube.com/watch?v=Qcv1IqHWAzg
<lang REXX>/*- REXX --------------------------------------------------------------
<lang REXX>/*- REXX --------------------------------------------------------------
Line 5,626: Line 5,623:
If debug Then
If debug Then
Call dbg arg(1)
Call dbg arg(1)
Return</lang>
Return
repl: Procedure
Parse Arg s,new,old
Do i=1 To 100 Until p=0
p=pos(old,s)
If p>0 Then
s=left(s,p-1)||new||substr(s,p+length(old))
End
Return s </lang>
{{out}}
{{out}}
<pre>
<pre>