What does the flowchart look like?
Ready to draw?
No signup. Opens instantly in your browser.
What is the matching code?
Pseudocode
read a, b
temp = a
a = b
b = tempPython
def swap(a, b):
temp = a
a = b
b = temp
return a, bC
void swap(int *a, int *b) {
int temp = *a;
*a = *b;
*b = temp;
}- If a is 3 and b is 8, temp becomes 3, a becomes 8, and b becomes 3.
- A swap that uses addition or XOR is a different algorithm. This chart is the three-variable swap.