2017年4月1日

binaryTree.js

摘要: function Node(data, left, right) { this.data = data; this.left = left; this.right = right; this.show = show; } function show() { return this.data; } function BST() { this.root = null; this.i... 阅读全文

posted @ 2017-04-01 10:23 carlyin 阅读(114) 评论(0) 推荐(0)

set.js

摘要: function Set() { this.dataStore = []; this.add = add; this.remove = remove; this.size = size; this.union = union; this.intersect = intersect; this.subset = subset; this.difference = differenc... 阅读全文

posted @ 2017-04-01 10:21 carlyin 阅读(113) 评论(0) 推荐(0)

Stack.js

摘要: function Stack() { this.dataStore = []; this.top = 0; this.push = push; this.pop = pop; this.clear = clear; this.peek = peek; this.length = length; } function push(element) { this.dataStore[... 阅读全文

posted @ 2017-04-01 10:20 carlyin 阅读(114) 评论(0) 推荐(0)

Queue.js

摘要: var fs=require('fs'); function Queue() { this.dataStore = []; this.enqueue = enqueue; this.dequeue = dequeue; this.front = front; this.back = back; this.toString = toString; this.empty = empt... 阅读全文

posted @ 2017-04-01 10:19 carlyin 阅读(144) 评论(0) 推荐(0)

hash.js

摘要: function HashTable() { this.table = new Array(137); this.simpleHash = simpleHash; this.showDistro = showDistro; this.put = put; //this.get = get; } function put(data) { var pos = this.simpleHa... 阅读全文

posted @ 2017-04-01 10:18 carlyin 阅读(153) 评论(0) 推荐(0)

dictionary.js

摘要: function Dictionary(){ this.datastore={}; this.add=add; this.find=find; this.remove=remove; this.showAll=showAll; } function add(key,value){ this.datastore[key]=value; } function find(key){ ... 阅读全文

posted @ 2017-04-01 10:17 carlyin 阅读(91) 评论(0) 推荐(0)

bank.js

摘要: function Checking(amount){ if(amount){ this.banlance=amount; }else{ this.banlance=0; }; this.deposit=function(dep){ this.banlance+=dep; }; this.withdraw=func... 阅读全文

posted @ 2017-04-01 10:16 carlyin 阅读(206) 评论(0) 推荐(0)

arraylist.js

摘要: function List() { this.listSize = 0; this.pos = 0; this.dataStore = []; // 初始化一个空数组来保存列表元素 this.clear = clear; this.find = find; this.toString = toStri... 阅读全文

posted @ 2017-04-01 10:16 carlyin 阅读(381) 评论(0) 推荐(0)

导航