Giter Club home page Giter Club logo

iruka's People

Contributors

dependabot[bot] avatar jeffzh4ng avatar jp-tran avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iruka's Issues

MinBinaryHeap heapify calls compare function when unnecessary

I'm talking about this call:

const elementIsLessThanChild = this.less(k, smallestIndex)

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

Missed = sign on linkedlist implementation

In LinkedList implementation:

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 :)

question: hash-table-open-addressing-base no.125 line

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
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.