Coder Social home page Coder Social logo

jeffzh4ng / iruka Goto Github PK

View Code? Open in Web Editor NEW
784.0 26.0 94.0 1.85 MB

data structures and algorithms

Home Page: https://www.youtube.com/playlist?list=PLn4fTSbSpY5cL4_0MP83wq5khbmG3IKKd

License: MIT License

JavaScript 0.17% TypeScript 99.83%
typescript binomial-heap fibonacci-heap binary-search-tree avl-tree red-black-tree b-tree algorithms-and-data-structures linked-list stack queue binary-heap hash-tables dijsktra bellman-ford floyd-warshall

iruka's Introduction

iruka

Tests

Mirror

A collection of classical data structures and algorithms implemented in Typescript. Click the ๐Ÿ“น emoji for tutorials.

The repository's primary goal is educational. Hence, all implementations include a prolific number of comments which guide the reader. The name of the project, iruka, is an ode to Iruka sensei from Naruto. He became a teacher to pass on the Will of Fire, and teach the future ninja of the leaf village. Likewise, this project is here to teach the future software engineers of earth.

You can use this package in your projects if you so wish. Test coverage will be kept at 100%. To install the package, use npm or yarn:

yarn add dsa-ts

Data Structures

Algorithms

References

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Commiting Process

The commit process does not directly use git. dsa-ts uses commitizen to ensure we are comitting semantic commits. To commit, use the command yarn commit, and follow the citizen cli which prompts you for various metainfo regarding the commit. After the pre-commit tests are run successfully, you are able to push to your development branch with git push.

License

This repository is released under the MIT license. In short, this means you are free to use this software in any personal, open-source or commercial projects.

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

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
  }

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

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.