jeffzh4ng / iruka Goto Github PK
View Code? Open in Web Editor NEWdata structures and algorithms
Home Page: https://www.youtube.com/playlist?list=PLn4fTSbSpY5cL4_0MP83wq5khbmG3IKKd
License: MIT License
data structures and algorithms
Home Page: https://www.youtube.com/playlist?list=PLn4fTSbSpY5cL4_0MP83wq5khbmG3IKKd
License: MIT License
I'm talking about this call:
This call should not always happen here, as it can cause the compare function to be called with undefined values while the compare function should only receive whatever the generic heap value type is.
This is causing an issue for me when constructing a MinHeap with heapify as I'm storing key-value pairs in a length-2 array. My compare function ((a, b) => a[0] - b[0]
) is being called even though indexOutOfBounds
is true, which causes undefined to be passed as b
, causing TypeError: Cannot read property '0' of undefined
.
Inlining the function call fixes it:
const indexOutOfBounds = leftChildIndex >= this.size()
if (indexOutOfBounds || this.less(k, smallestIndex)) break
Alternatively the bound check can be put in the while
condition
With semantic-release and commitizen
Create the HelloWorld data structure
link
in line 116 I think this should be (i > list.size())
no equal needed as we already checked it in the previous if condition and we only want to make sure it's not bigger than list bound.
in line 120: I think we should loop until
j < i
not
j < i -1
,
for (let j = 0; j < i; j++) {
cur = cur.next
}
we need current pointer to hold the node before the ith node, so if i = 3 we want it to be the third node in the list so cur should point to i -1 that is 2
OR you missed = sign
for (let j = 0; j <= i -1; j++) {
cur = cur.next
}
and If you approve I can make PR with these changes
PS: thank you so much I really enjoyed your videos :)
values(): Array<V> {
const values: Array<V> = []
for (let i = 0; i < this.keyList.length; i++) {
if (this.keyList[i] && this.keyList[i] !== this.TOMBSTONE) values.push(values[i]) // values.push(this.valueList[i]) ?
}
return values
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.