Skip to content

Commit 6882c42

Browse files
authored
Merge pull request #52 from DMU-DebugVisual/dongjun
API 연동 하이브리드 시각화 시스템 구현
2 parents e93b730 + e57075f commit 6882c42

File tree

9 files changed

+1696
-1203
lines changed

9 files changed

+1696
-1203
lines changed

src/components/ide/VisualizationModal.jsx

Lines changed: 467 additions & 1203 deletions
Large diffs are not rendered by default.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"algorithm": "binary-tree",
3+
"lang": "c",
4+
"input": "",
5+
"variables": [
6+
{ "name": "root", "type": "Node*", "initialValue": "NULL", "currentValue": "0x01" },
7+
{ "name": "newNode", "type": "Node*", "initialValue": null, "currentValue": "0x05" }
8+
],
9+
"functions": [
10+
{ "name": "createNode", "params": ["data"] },
11+
{ "name": "insert", "params": ["root", "data"] },
12+
{ "name": "inorder", "params": ["root"] }
13+
],
14+
"steps": [
15+
{ "line": 29, "description": "main 시작, root 초기화", "changes": [{ "variable": "root", "before": "NULL", "after": "NULL" }] },
16+
{ "line": 30, "description": "insert(root, 50) 호출", "stack": [{ "function": "insert", "params": ["NULL", 50] }] },
17+
{ "line": 17, "description": "root == NULL, createNode(50) 호출", "stack": [{ "function": "createNode", "params": [50] }] },
18+
{ "line": 11, "description": "newNode 생성 및 초기화", "changes": [{ "variable": "newNode", "before": null, "after": "0x01" }], "dataStructure": { "type": "bst", "nodes": [{ "id": "0x01", "value": 50, "links": [] }] } },
19+
{ "line": 13, "description": "createNode 반환", "stack": [{ "function": "insert", "params": ["NULL", 50] }] },
20+
{ "line": 18, "description": "insert 반환, root=0x01", "changes": [{ "variable": "root", "before": "NULL", "after": "0x01" }] },
21+
{ "line": 31, "description": "insert(root, 30) 호출", "stack": [{ "function": "insert", "params": ["0x01", 30] }] },
22+
{ "line": 19, "description": "30 < 50, insert(root->left, 30) 재귀호출", "stack": [{ "function": "insert", "params": ["NULL", 30] }] },
23+
{ "line": 17, "description": "root==NULL, createNode(30) 호출", "stack": [{ "function": "createNode", "params": [30] }] },
24+
{ "line": 11, "description": "newNode 생성 및 초기화", "changes": [{ "variable": "newNode", "before": "0x01", "after": "0x02" }], "dataStructure": { "type": "bst", "nodes": [{ "id": "0x01", "value": 50, "links": ["0x02"] }, { "id": "0x02", "value": 30, "links": [] }] } },
25+
{ "line": 13, "description": "createNode 반환", "stack": [{ "function": "insert", "params": ["NULL", 30] }] },
26+
{ "line": 18, "description": "재귀 insert 반환, root->left=0x02", "stack": [{ "function": "insert", "params": ["0x01", 30] }] },
27+
{ "line": 22, "description": "insert 반환" },
28+
{ "line": 32, "description": "insert(root, 70) 호출", "stack": [{ "function": "insert", "params": ["0x01", 70] }] },
29+
{ "line": 20, "description": "70 > 50, insert(root->right, 70) 재귀호출", "stack": [{ "function": "insert", "params": ["NULL", 70] }] },
30+
{ "line": 17, "description": "root==NULL, createNode(70) 호출", "stack": [{ "function": "createNode", "params": [70] }] },
31+
{ "line": 11, "description": "newNode 생성 및 초기화", "changes": [{ "variable": "newNode", "before": "0x02", "after": "0x03" }], "dataStructure": { "type": "bst", "nodes": [{ "id": "0x01", "value": 50, "links": ["0x02", "0x03"] }, { "id": "0x02", "value": 30, "links": [] }, { "id": "0x03", "value": 70, "links": [] }] } },
32+
{ "line": 13, "description": "createNode 반환", "stack": [{ "function": "insert", "params": ["NULL", 70] }] },
33+
{ "line": 18, "description": "재귀 insert 반환, root->right=0x03", "stack": [{ "function": "insert", "params": ["0x01", 70] }] },
34+
{ "line": 22, "description": "insert 반환" },
35+
{ "line": 33, "description": "insert(root, 20) 호출", "stack": [{ "function": "insert", "params": ["0x01", 20] }] },
36+
{ "line": 19, "description": "20 < 50, insert(root->left, 20) 재귀호출", "stack": [{ "function": "insert", "params": ["0x02", 20] }] },
37+
{ "line": 19, "description": "20 < 30, insert(root->left, 20) 재귀호출", "stack": [{ "function": "insert", "params": ["NULL", 20] }] },
38+
{ "line": 17, "description": "root==NULL, createNode(20) 호출", "stack": [{ "function": "createNode", "params": [20] }] },
39+
{ "line": 11, "description": "newNode 생성 및 초기화", "changes": [{ "variable": "newNode", "before": "0x03", "after": "0x04" }], "dataStructure": { "type": "bst", "nodes": [{ "id": "0x01", "value": 50, "links": ["0x02", "0x03"] }, { "id": "0x02", "value": 30, "links": ["0x04"] }, { "id": "0x03", "value": 70, "links": [] }, { "id": "0x04", "value": 20, "links": [] }] } },
40+
{ "line": 13, "description": "createNode 반환" },
41+
{ "line": 18, "description": "재귀 insert 반환, root->left=0x04" },
42+
{ "line": 18, "description": "재귀 insert 반환, root->left=0x02" },
43+
{ "line": 22, "description": "insert 반환" },
44+
{ "line": 34, "description": "insert(root, 40) 호출", "stack": [{ "function": "insert", "params": ["0x01", 40] }] },
45+
{ "line": 19, "description": "40 < 50, insert(root->left, 40) 재귀호출", "stack": [{ "function": "insert", "params": ["0x02", 40] }] },
46+
{ "line": 20, "description": "40 > 30, insert(root->right, 40) 재귀호출", "stack": [{ "function": "insert", "params": ["NULL", 40] }] },
47+
{ "line": 17, "description": "root==NULL, createNode(40) 호출", "stack": [{ "function": "createNode", "params": [40] }] },
48+
{ "line": 11, "description": "newNode 생성 및 초기화", "changes": [{ "variable": "newNode", "before": "0x04", "after": "0x05" }], "dataStructure": { "type": "bst", "nodes": [{ "id": "0x01", "value": 50, "links": ["0x02", "0x03"] }, { "id": "0x02", "value": 30, "links": ["0x04", "0x05"] }, { "id": "0x03", "value": 70, "links": [] }, { "id": "0x04", "value": 20, "links": [] }, { "id": "0x05", "value": 40, "links": [] }] } },
49+
{ "line": 13, "description": "createNode 반환" },
50+
{ "line": 18, "description": "재귀 insert 반환, root->right=0x05" },
51+
{ "line": 18, "description": "재귀 insert 반환, root->left=0x02" },
52+
{ "line": 22, "description": "insert 반환" },
53+
{ "line": 36, "description": "printf(\"Inorder Traversal\")" },
54+
{ "line": 37, "description": "inorder(root) 호출", "stack": [{ "function": "inorder", "params": ["0x01"] }] },
55+
{ "line": 25, "description": "inorder(root->left) 호출", "stack": [{ "function": "inorder", "params": ["0x02"] }] },
56+
{ "line": 25, "description": "inorder(root->left) 호출", "stack": [{ "function": "inorder", "params": ["0x04"] }] },
57+
{ "line": 25, "description": "inorder(root->left=NULL), 반환" },
58+
{ "line": 27, "description": "출력: 20" },
59+
{ "line": 28, "description": "inorder(root->right=NULL), 반환" },
60+
{ "line": 27, "description": "출력: 30" },
61+
{ "line": 28, "description": "inorder(root->right) 호출", "stack": [{ "function": "inorder", "params": ["0x05"] }] },
62+
{ "line": 25, "description": "inorder(root->left=NULL), 반환" },
63+
{ "line": 27, "description": "출력: 40" },
64+
{ "line": 28, "description": "inorder(root->right=NULL), 반환" },
65+
{ "line": 27, "description": "출력: 50" },
66+
{ "line": 28, "description": "inorder(root->right) 호출", "stack": [{ "function": "inorder", "params": ["0x03"] }] },
67+
{ "line": 25, "description": "inorder(root->left=NULL), 반환" },
68+
{ "line": 27, "description": "출력: 70" },
69+
{ "line": 28, "description": "inorder(root->right=NULL), 반환" },
70+
{ "line": 39, "description": "main 종료" }
71+
]
72+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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

Comments
 (0)