nlptoolkit-datastructure
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -5,2 +5,3 @@ export declare class Heap<T> { | ||
private count; | ||
private n; | ||
constructor(N: number, comparator: <T>(item1: T, item2: T) => number); | ||
@@ -7,0 +8,0 @@ compare(data1: T, data2: T): number; |
@@ -19,2 +19,3 @@ (function (factory) { | ||
this.count = 0; | ||
this.n = N; | ||
for (let i = 0; i < N; i++) { | ||
@@ -68,3 +69,5 @@ this.array.push(); | ||
insert(data) { | ||
this.count = this.count + 1; | ||
if (this.count < this.n) { | ||
this.count = this.count + 1; | ||
} | ||
this.array[this.count - 1] = new HeapNode_1.HeapNode(data); | ||
@@ -71,0 +74,0 @@ this.percolateUp(this.count - 1); |
{ | ||
"name": "nlptoolkit-datastructure", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple Data Structures Library", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,2 +8,3 @@ import {HeapNode} from "./HeapNode"; | ||
private count: number | ||
private n: number | ||
@@ -14,2 +15,3 @@ constructor(N: number, comparator: <T>(item1: T, item2: T) => number){ | ||
this.count = 0 | ||
this.n = N | ||
for (let i = 0; i < N; i++){ | ||
@@ -69,3 +71,5 @@ this.array.push() | ||
public insert(data: T){ | ||
this.count = this.count + 1 | ||
if (this.count < this.n) { | ||
this.count = this.count + 1 | ||
} | ||
this.array[this.count - 1] = new HeapNode<T>(data) | ||
@@ -72,0 +76,0 @@ this.percolateUp(this.count - 1) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90280
1856