修改二叉树回指的bug

This commit is contained in:
cjc 2022-03-11 17:07:09 +08:00
parent 4bb64214e7
commit d06a0e15e8
2 changed files with 168 additions and 195 deletions

View File

@ -5,7 +5,7 @@ SV.registerLayout('BinaryTree', {
default: {
type: 'binary-tree-node',
size: [60, 30],
label: '[id]',
label: '[data]',
style: {
fill: '#b83b5e',
stroke: '#333',
@ -77,6 +77,8 @@ SV.registerLayout('BinaryTree', {
return null;
}
node.visited = true;
if (node.child && node.child[0]) {
leftGroup = this.layoutItem(node.child[0], layoutOptions);
}
@ -120,7 +122,6 @@ SV.registerLayout('BinaryTree', {
node.set('x', rightBound.x - layoutOptions.xInterval / 2 - width);
}
node.visited = true;
if (leftGroup) {
group.add(leftGroup);
@ -144,13 +145,11 @@ SV.registerLayout('BinaryTree', {
},
});
[
{
[{
id: 6385328,
data: '',
external: ['L'],
root: true,
after: null,
next: null,
},
];
}, ];

View File

@ -1,103 +1,77 @@
const SOURCES_DATA = [{
"LinkList0": {
"BinaryTree0": {
"data": [{
"id": "0x616eb0",
"data": "Z",
"next": "0x616ef0",
"loopNext": null,
"rootExternal": [
"L"
"external": [
"T1"
],
"child": [
"0x617ee0",
"0x617f10"
],
"id": "0x617eb0",
"name": "T1",
"data": "Z",
"root": true,
"type": "default"
},
{
"freed": true,
"id": "0x616ef0",
"data": "",
"next": "0x605010",
"loopNext": null,
"child": [
"0x0",
"0x0"
],
"id": "0x617ee0",
"name": "T1->lchild",
"data": "D",
"type": "default"
},
{
"id": "0x605010",
"data": "1",
"external": [
"t"
"child": [
"0x617f70",
"0x617f40"
],
"next": null,
"loopNext": null,
"id": "0x617f10",
"name": "T1->rchild",
"data": "C",
"type": "default"
}
],
"layouter": "LinkList"
},
"handleUpdate": {
"isEnterFunction": false,
"isFirstDebug": false
}
}, {
"LinkList0": {
"data": [{
"id": "0x616eb0",
"data": "Z",
"external": [
"L"
],
"next": "0x616ef0",
"loopNext": null
},
{
"freed": true,
"id": "0x616ef0",
"data": "",
"next": "0x605010",
"loopNext": null
"child": [
"0x0",
"0x0"
],
"id": "0x617f70",
"name": "(T1->rchild)->lchild",
"data": "A",
"type": "default"
},
{
"id": "0x605010",
"data": "1",
"child": [
"0x0",
"0x617fa0"
],
"id": "0x617f40",
"name": "(T1->rchild)->rchild",
"data": "B",
"type": "default",
"external": [
"t"
],
"next": null,
"loopNext": null
}
],
"layouter": "LinkList"
},
"handleUpdate": {
"isEnterFunction": false,
"isFirstDebug": false
}
}, {
"LinkList0": {
"data": [{
"id": "0x616eb0",
"data": "Z",
"external": [
"L"
],
"next": "0x616ef0",
"loopNext": null
]
},
{
"freed": true,
"id": "0x616ef0",
"data": "",
"next": "0x605010",
"loopNext": null
},
{
"id": "0x605010",
"data": "1",
"external": [
"t"
"child": [
"0x0",
"0x617f40"
],
"next": null,
"loopNext": null
"id": "0x617fa0",
"name": "((T1->rchild)->rchild)->rchild",
"data": "E",
"type": "default",
"external": [
"r"
]
}
],
"layouter": "LinkList"
"layouter": "BinaryTree"
},
"handleUpdate": {
"isEnterFunction": false,