data-footstone
Advanced tools
Comparing version 0.1.16 to 0.1.17-alpha.0
@@ -8,3 +8,3 @@ 'use strict'; | ||
var tree = require('./tree.js'); | ||
var order = require('./order.js'); | ||
var sort = require('./sort.js'); | ||
var store = require('./store.js'); | ||
@@ -28,3 +28,3 @@ var graph = require('./graph.js'); | ||
exports.BinaryTree = tree.BinaryTree; | ||
exports.order = order; | ||
exports.sort = sort; | ||
exports.Fifo = store.Fifo; | ||
@@ -31,0 +31,0 @@ exports.Lfu = store.Lfu; |
@@ -572,3 +572,3 @@ 'use strict'; | ||
// 是否avl平衡 | ||
AvlBalanced(n) { | ||
avlBalanced(n) { | ||
if (!n) { | ||
@@ -597,3 +597,3 @@ return true; | ||
while (p) { | ||
if (!this.AvlBalanced(p)) { | ||
if (!this.avlBalanced(p)) { | ||
if (p.parent) { // 非根节点 | ||
@@ -694,3 +694,2 @@ this.rotateAt(this.tallerChild(this.tallerChild(p))); | ||
rotateAt(v) { | ||
// console.log('v', v) | ||
// v是孙辈的节点,不平衡。 | ||
@@ -704,5 +703,4 @@ // 至少有3层,才会出现不平衡,所以一定会有父节点、祖节点。 | ||
if (p['operator==='](g.left)) { | ||
// console.log('left g') | ||
if (v['operator==='](p.left)) { | ||
console.log('left left p'); | ||
// console.log('left left p') | ||
// v p g | ||
@@ -712,3 +710,3 @@ return this._connect34(v, p, g, v.left, v.right, p.right, g.right); | ||
else { | ||
console.log('left right p'); | ||
// console.log('left right p') | ||
// p v g | ||
@@ -721,3 +719,3 @@ return this._connect34(p, v, g, p.left, v.left, v.right, g.right); | ||
if (v['operator==='](p.left)) { | ||
console.log('right left p'); | ||
// console.log('right left p') | ||
// g v p | ||
@@ -727,3 +725,3 @@ return this._connect34(g, v, p, g.left, v.left, v.right, p.right); | ||
else { | ||
console.log('right right p'); | ||
// console.log('right right p') | ||
// g p v | ||
@@ -745,3 +743,3 @@ return this._connect34(g, p, v, g.left, p.left, v.left, v.right); | ||
while (p) { | ||
if (!this.AvlBalanced(p)) { | ||
if (!this.avlBalanced(p)) { | ||
if (p.parent) { // 非根节点 | ||
@@ -748,0 +746,0 @@ this.rotateAt(this.tallerChild(this.tallerChild(p))); |
@@ -6,6 +6,6 @@ export { Stack } from './stack.js'; | ||
export { AVLTree, BinarySearchTree, BinaryTree } from './tree.js'; | ||
import * as order from './order.js'; | ||
export { order }; | ||
import * as sort from './sort.js'; | ||
export { sort }; | ||
export { Fifo, Lfu, Lru } from './store.js'; | ||
export { DirectionGraph, UndirectionGraph } from './graph.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -570,3 +570,3 @@ import { Queue } from './queue.js'; | ||
// 是否avl平衡 | ||
AvlBalanced(n) { | ||
avlBalanced(n) { | ||
if (!n) { | ||
@@ -595,3 +595,3 @@ return true; | ||
while (p) { | ||
if (!this.AvlBalanced(p)) { | ||
if (!this.avlBalanced(p)) { | ||
if (p.parent) { // 非根节点 | ||
@@ -692,3 +692,2 @@ this.rotateAt(this.tallerChild(this.tallerChild(p))); | ||
rotateAt(v) { | ||
// console.log('v', v) | ||
// v是孙辈的节点,不平衡。 | ||
@@ -702,5 +701,4 @@ // 至少有3层,才会出现不平衡,所以一定会有父节点、祖节点。 | ||
if (p['operator==='](g.left)) { | ||
// console.log('left g') | ||
if (v['operator==='](p.left)) { | ||
console.log('left left p'); | ||
// console.log('left left p') | ||
// v p g | ||
@@ -710,3 +708,3 @@ return this._connect34(v, p, g, v.left, v.right, p.right, g.right); | ||
else { | ||
console.log('left right p'); | ||
// console.log('left right p') | ||
// p v g | ||
@@ -719,3 +717,3 @@ return this._connect34(p, v, g, p.left, v.left, v.right, g.right); | ||
if (v['operator==='](p.left)) { | ||
console.log('right left p'); | ||
// console.log('right left p') | ||
// g v p | ||
@@ -725,3 +723,3 @@ return this._connect34(g, v, p, g.left, v.left, v.right, p.right); | ||
else { | ||
console.log('right right p'); | ||
// console.log('right right p') | ||
// g p v | ||
@@ -743,3 +741,3 @@ return this._connect34(g, p, v, g.left, p.left, v.left, v.right); | ||
while (p) { | ||
if (!this.AvlBalanced(p)) { | ||
if (!this.avlBalanced(p)) { | ||
if (p.parent) { // 非根节点 | ||
@@ -746,0 +744,0 @@ this.rotateAt(this.tallerChild(this.tallerChild(p))); |
{ | ||
"name": "data-footstone", | ||
"version": "0.1.16", | ||
"version": "0.1.17-alpha.0", | ||
"description": "data structure", | ||
@@ -53,9 +53,24 @@ "author": "feigebaobei <18515195415@163.com>", | ||
"construction", | ||
"Stack", | ||
"Queue", | ||
"LinkedList", | ||
"HashTable", | ||
"Tree", | ||
"Graph", | ||
"Order" | ||
"stack", | ||
"queue", | ||
"PriorityQueue", | ||
"chain", | ||
"SingleChain", | ||
"DoublyChain", | ||
"SingleCircleChain", | ||
"DoublyCircleChain", | ||
"hashMap", | ||
"hash方法", | ||
"tree", | ||
"BinaryTree", | ||
"BinarySearchTree", | ||
"AVLTree", | ||
"graph", | ||
"DirectionGraph", | ||
"UndirectionGraph", | ||
"sort", | ||
"cache", | ||
"fifo", | ||
"lru", | ||
"lfu" | ||
], | ||
@@ -75,3 +90,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "71e200acd4d891ce91bfdaf051fc846195131a41" | ||
"gitHead": "0e46d12203aa0653e208098cdacf87b215bb1060" | ||
} |
@@ -12,3 +12,3 @@ import { Stack } from './stack'; | ||
} from './tree'; | ||
import * as order from './order'; | ||
import * as sort from './sort'; | ||
import { Lru, Fifo, Lfu } from './store'; | ||
@@ -23,2 +23,2 @@ import { DirectionGraph, UndirectionGraph } from './graph'; | ||
// RedBackTree, | ||
order, Lru, Fifo, Lfu, DirectionGraph, UndirectionGraph, }; | ||
sort, Lru, Fifo, Lfu, DirectionGraph, UndirectionGraph, }; |
@@ -571,3 +571,3 @@ import { Queue } from './queue'; | ||
// 是否avl平衡 | ||
AvlBalanced(n) { | ||
avlBalanced(n) { | ||
if (!n) { | ||
@@ -596,3 +596,3 @@ return true; | ||
while (p) { | ||
if (!this.AvlBalanced(p)) { | ||
if (!this.avlBalanced(p)) { | ||
if (p.parent) { // 非根节点 | ||
@@ -693,3 +693,2 @@ this.rotateAt(this.tallerChild(this.tallerChild(p))); | ||
rotateAt(v) { | ||
// console.log('v', v) | ||
// v是孙辈的节点,不平衡。 | ||
@@ -703,5 +702,4 @@ // 至少有3层,才会出现不平衡,所以一定会有父节点、祖节点。 | ||
if (p['operator==='](g.left)) { | ||
// console.log('left g') | ||
if (v['operator==='](p.left)) { | ||
console.log('left left p'); | ||
// console.log('left left p') | ||
// v p g | ||
@@ -711,3 +709,3 @@ return this._connect34(v, p, g, v.left, v.right, p.right, g.right); | ||
else { | ||
console.log('left right p'); | ||
// console.log('left right p') | ||
// p v g | ||
@@ -720,3 +718,3 @@ return this._connect34(p, v, g, p.left, v.left, v.right, g.right); | ||
if (v['operator==='](p.left)) { | ||
console.log('right left p'); | ||
// console.log('right left p') | ||
// g v p | ||
@@ -726,3 +724,3 @@ return this._connect34(g, v, p, g.left, v.left, v.right, p.right); | ||
else { | ||
console.log('right right p'); | ||
// console.log('right right p') | ||
// g p v | ||
@@ -744,3 +742,3 @@ return this._connect34(g, p, v, g.left, p.left, v.left, v.right); | ||
while (p) { | ||
if (!this.AvlBalanced(p)) { | ||
if (!this.avlBalanced(p)) { | ||
if (p.parent) { // 非根节点 | ||
@@ -747,0 +745,0 @@ this.rotateAt(this.tallerChild(this.tallerChild(p))); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
554177
84
8438