二维数据结构
二维的数据结构:二维数组
// 二位数据结构let arr = new Array(7);for (let i = 0; i < arr.length; i++) {arr[i] = []for(let j = 0 ; j< 8; j++){arr[i].push(j)}}console.log(arr)
二维拓步结构(图)
像是人际关系图 如下图
他只看两者之间是否又关系不看是否完全相等。
其对应的代码为
/*** 二维拓步结构 (图)* @param {any} value*/function Node(value) {this.value = value;this.neighbor = [];}let a = new Node("a")let b = new Node("b")let c = new Node("c")let d = new Node("d")let e = new Node("e")let f = new Node("f")// a 的关系a.neighbor.push(b)a.neighbor.push(c)a.neighbor.push(f)// b 的关系b.neighbor.push(d)b.neighbor.push(e)b.neighbor.push(a)// c 的关系c.neighbor.push(a)// d 的关系d.neighbor.push(b)// e 的关系e.neighbor.push(b)// f 的关系f.neighbor.push(a)
