Click here to Skip to main content
16,020,114 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Provide a concise functional overview of the code excerpt mentioned below,
Question 1
Delphi
procedure f(var A : array of integer; L, R: Integer);
var
 I, J: Integer;
 P, T: Integer;
begin
 repeat
 I := L;
 J := R;
 P := A[(L + R) shr 1];
 repeat
 while A[I] < P do
 Inc(I);
 while A[J] > P do
 Dec(J);
 if I <= J then
 begin
 T := A[I];
 A[I] := A[J];
 A[J] := T;
 Inc(I);
 Dec(J);
 end;
 until I > J;
 if L < J then
 f(A, L, J);
 L := I;
 until I >= R;
end;
Question 2
procedure f( var a : integer; var b : integer );
begin
 a := a xor b;
 b := a xor b;
 a := a xor b;
end;
Posted
Updated 13-Apr-15 20:37pm
v4
Comments
Sergey Alexandrovich Kryukov 14-Apr-15 2:37am    
This is not a question; the post in unclear and does not seem to make any sense. "Functional overview"? Why?
—SA

1 solution

This is the interview question was asked, just want to know the what is the output of the functions and explain me the logic.
 
Share this answer
 
Comments
Richard MacCutchan 14-Apr-15 4:07am    
This is the wrong place. This forum is for answering technical questions not analysing your code. I will say that it is one of the worst examples of programming that I have seen recently.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900