06 2020 档案
摘要:/* 建造最大堆 */ // 创建堆 function CreateHeap(MaxSize,MaxData,initialData) { this.MaxSize = MaxSize; this.Heap = initialData; if(!initialData) { this.Heap =
阅读全文
摘要:// 创建堆 function CreateHeap(MaxSize,MaxData) { this.MaxSize = MaxSize; this.Heap = new Array(); this.Heap[0] = MaxData // 定义" 哨兵 " 为大于堆中所有可能元素的值 this.i
阅读全文
摘要:// 树根 function Tree(data,left,right) { this.data = data this.left = left this.right = right this.leftNode = Tree.leftNode this.rightNode = Tree.rightN
阅读全文
摘要:function Node(coef,expon) { this.coef = coef; // 系数 this.expon = expon; // 指数 this.next = null; } List.attach = function(node) { let current = this.he
阅读全文
摘要:/** * Initialize your data structure here. */ var MyStack = function() { this.inQueue = []; this.outQueue = []; }; /** * Push element x onto stack. *
阅读全文
摘要:/** * Initialize your data structure here. */ var MyQueue = function() { this.stack1 = []; this.stack2 = []; }; /** * Push element x to the back of qu
阅读全文
摘要:Queue.isEmpty = function() { return (this.front == this.rear); } Queue.isFull = function() { return ((this.rear + 1) % this.MaxSize == this.front); }
阅读全文