1+ {
2+ "algorithm" : " bubble-sort" ,
3+ "lang" : " c" ,
4+ "input" : " " ,
5+ "variables" : [
6+ { "name" : " MAX_SIZE" , "type" : " int" , "initialValue" : null , "currentValue" : 5 },
7+ { "name" : " i" , "type" : " int" , "initialValue" : null , "currentValue" : 0 },
8+ { "name" : " n" , "type" : " int" , "initialValue" : null , "currentValue" : 5 },
9+ { "name" : " list" , "type" : " array" , "initialValue" : null , "currentValue" : [5 , 1 , 7 , 4 , 3 ] },
10+ { "name" : " j" , "type" : " int" , "initialValue" : null , "currentValue" : 0 },
11+ { "name" : " temp" , "type" : " int" , "initialValue" : null , "currentValue" : 0 }
12+ ],
13+ "functions" : [
14+ { "name" : " bubble_sort" , "params" : [" list" , " n" ] }
15+ ],
16+ "steps" : [
17+ { "line" : 21 , "description" : " 함수 bubble_sort 호출" , "stack" : [{ "function" : " bubble_sort" , "params" : [[5 , 1 , 7 , 4 , 3 ], 5 ] }] },
18+ { "line" : 8 , "description" : " i=n-1로 초기화" , "changes" : [{ "variable" : " i" , "before" : null , "after" : 4 }] },
19+ { "line" : 8 , "description" : " i 조건 검사 (4>0)" , "condition" : { "expression" : " i>0" , "result" : true } },
20+ { "line" : 10 , "description" : " j=0으로 초기화" , "changes" : [{ "variable" : " j" , "before" : null , "after" : 0 }] },
21+ { "line" : 10 , "description" : " j 조건 검사 (0<4)" , "condition" : { "expression" : " j<4" , "result" : true } },
22+ { "line" : 12 , "description" : " 조건 검사 (list[0]<list[1]: 5<1)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : false } },
23+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 0 , "after" : 1 }] },
24+ { "line" : 10 , "description" : " j 조건 검사 (1<4)" , "condition" : { "expression" : " j<4" , "result" : true } },
25+ { "line" : 12 , "description" : " 조건 검사 (list[1]<list[2]: 1<7)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : true } },
26+ { "line" : 13 , "description" : " temp=list[1]=1" , "changes" : [{ "variable" : " temp" , "before" : null , "after" : 1 }] },
27+ { "line" : 14 , "description" : " list[1]=list[2]=7" , "changes" : [{ "variable" : " list" , "before" : [5 , 1 , 7 , 4 , 3 ], "after" : [5 , 7 , 7 , 4 , 3 ] }] },
28+ { "line" : 15 , "description" : " list[2]=temp=1" , "changes" : [{ "variable" : " list" , "before" : [5 , 7 , 7 , 4 , 3 ], "after" : [5 , 7 , 1 , 4 , 3 ] }] },
29+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 1 , "after" : 2 }] },
30+ { "line" : 10 , "description" : " j 조건 검사 (2<4)" , "condition" : { "expression" : " j<4" , "result" : true } },
31+ { "line" : 12 , "description" : " 조건 검사 (list[2]<list[3]: 1<4)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : true } },
32+ { "line" : 13 , "description" : " temp=list[2]=1" , "changes" : [{ "variable" : " temp" , "before" : 1 , "after" : 1 }] },
33+ { "line" : 14 , "description" : " list[2]=list[3]=4" , "changes" : [{ "variable" : " list" , "before" : [5 , 7 , 1 , 4 , 3 ], "after" : [5 , 7 , 4 , 4 , 3 ] }] },
34+ { "line" : 15 , "description" : " list[3]=temp=1" , "changes" : [{ "variable" : " list" , "before" : [5 , 7 , 4 , 4 , 3 ], "after" : [5 , 7 , 4 , 1 , 3 ] }] },
35+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 2 , "after" : 3 }] },
36+ { "line" : 10 , "description" : " j 조건 검사 (3<4)" , "condition" : { "expression" : " j<4" , "result" : true } },
37+ { "line" : 12 , "description" : " 조건 검사 (list[3]<list[4]: 1<3)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : true } },
38+ { "line" : 13 , "description" : " temp=list[3]=1" , "changes" : [{ "variable" : " temp" , "before" : 1 , "after" : 1 }] },
39+ { "line" : 14 , "description" : " list[3]=list[4]=3" , "changes" : [{ "variable" : " list" , "before" : [5 , 7 , 4 , 1 , 3 ], "after" : [5 , 7 , 4 , 3 , 3 ] }] },
40+ { "line" : 15 , "description" : " list[4]=temp=1" , "changes" : [{ "variable" : " list" , "before" : [5 , 7 , 4 , 3 , 3 ], "after" : [5 , 7 , 4 , 3 , 1 ] }] },
41+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 3 , "after" : 4 }] },
42+ { "line" : 10 , "description" : " j 조건 검사 (4<4)" , "condition" : { "expression" : " j<4" , "result" : false } },
43+ { "line" : 8 , "description" : " i--" , "changes" : [{ "variable" : " i" , "before" : 4 , "after" : 3 }] },
44+ { "line" : 8 , "description" : " i 조건 검사 (3>0)" , "condition" : { "expression" : " i>0" , "result" : true } },
45+ { "line" : 10 , "description" : " j=0으로 초기화" , "changes" : [{ "variable" : " j" , "before" : 4 , "after" : 0 }] },
46+ { "line" : 10 , "description" : " j 조건 검사 (0<3)" , "condition" : { "expression" : " j<3" , "result" : true } },
47+ { "line" : 12 , "description" : " 조건 검사 (list[0]<list[1]: 5<7)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : true } },
48+ { "line" : 13 , "description" : " temp=list[0]=5" , "changes" : [{ "variable" : " temp" , "before" : 1 , "after" : 5 }] },
49+ { "line" : 14 , "description" : " list[0]=list[1]=7" , "changes" : [{ "variable" : " list" , "before" : [5 , 7 , 4 , 3 , 1 ], "after" : [7 , 7 , 4 , 3 , 1 ] }] },
50+ { "line" : 15 , "description" : " list[1]=temp=5" , "changes" : [{ "variable" : " list" , "before" : [7 , 7 , 4 , 3 , 1 ], "after" : [7 , 5 , 4 , 3 , 1 ] }] },
51+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 0 , "after" : 1 }] },
52+ { "line" : 10 , "description" : " j 조건 검사 (1<3)" , "condition" : { "expression" : " j<3" , "result" : true } },
53+ { "line" : 12 , "description" : " 조건 검사 (list[1]<list[2]: 5<4)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : false } },
54+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 1 , "after" : 2 }] },
55+ { "line" : 10 , "description" : " j 조건 검사 (2<3)" , "condition" : { "expression" : " j<3" , "result" : true } },
56+ { "line" : 12 , "description" : " 조건 검사 (list[2]<list[3]: 4<3)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : false } },
57+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 2 , "after" : 3 }] },
58+ { "line" : 10 , "description" : " j 조건 검사 (3<3)" , "condition" : { "expression" : " j<3" , "result" : false } },
59+ { "line" : 8 , "description" : " i--" , "changes" : [{ "variable" : " i" , "before" : 3 , "after" : 2 }] },
60+ { "line" : 8 , "description" : " i 조건 검사 (2>0)" , "condition" : { "expression" : " i>0" , "result" : true } },
61+ { "line" : 10 , "description" : " j=0으로 초기화" , "changes" : [{ "variable" : " j" , "before" : 3 , "after" : 0 }] },
62+ { "line" : 10 , "description" : " j 조건 검사 (0<2)" , "condition" : { "expression" : " j<2" , "result" : true } },
63+ { "line" : 12 , "description" : " 조건 검사 (list[0]<list[1]: 7<5)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : false } },
64+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 0 , "after" : 1 }] },
65+ { "line" : 10 , "description" : " j 조건 검사 (1<2)" , "condition" : { "expression" : " j<2" , "result" : true } },
66+ { "line" : 12 , "description" : " 조건 검사 (list[1]<list[2]: 5<4)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : false } },
67+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 1 , "after" : 2 }] },
68+ { "line" : 10 , "description" : " j 조건 검사 (2<2)" , "condition" : { "expression" : " j<2" , "result" : false } },
69+ { "line" : 8 , "description" : " i--" , "changes" : [{ "variable" : " i" , "before" : 2 , "after" : 1 }] },
70+ { "line" : 8 , "description" : " i 조건 검사 (1>0)" , "condition" : { "expression" : " i>0" , "result" : true } },
71+ { "line" : 10 , "description" : " j=0으로 초기화" , "changes" : [{ "variable" : " j" , "before" : 2 , "after" : 0 }] },
72+ { "line" : 10 , "description" : " j 조건 검사 (0<1)" , "condition" : { "expression" : " j<1" , "result" : true } },
73+ { "line" : 12 , "description" : " 조건 검사 (list[0]<list[1]: 7<5)" , "condition" : { "expression" : " list[j]<list[j+1]" , "result" : false } },
74+ { "line" : 10 , "description" : " j++" , "changes" : [{ "variable" : " j" , "before" : 0 , "after" : 1 }] },
75+ { "line" : 10 , "description" : " j 조건 검사 (1<1)" , "condition" : { "expression" : " j<1" , "result" : false } },
76+ { "line" : 8 , "description" : " i--" , "changes" : [{ "variable" : " i" , "before" : 1 , "after" : 0 }] },
77+ { "line" : 8 , "description" : " i 조건 검사 (0>0)" , "condition" : { "expression" : " i>0" , "result" : false } },
78+ { "line" : 22 , "description" : " 함수 bubble_sort 반환" , "stack" : [] },
79+ { "line" : 25 , "description" : " 정렬된 배열 출력 (list: [7, 5, 4, 3, 1])" }
80+ ]
81+ }
0 commit comments