Code Monkey home page Code Monkey logo

computer-science-in-javascript's Issues

bubble-sort.js

is there a known issue for sorting when there is 0 in the array, I used a code similar to the one that you used in bubble-sort.js , but whenever I add 0 to the array it stays in same position and sorting starts after the 0

var array = [4, 7, 0, 5, 1, 3, 6, 2, 9, 8, 10, 13, 15, 12, 14, 11];

the result sorted array would be
[ 4, 7, 0, 1, 2, 3, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15 ]

ES6 Tree Remove. Sibling to removed node is not added to BFS queue

https://github.com/benoitvallon/computer-science-in-javascript/blob/master/data-structures-in-javascript/tree.es6.js#L33

Splice in the for loop shifts the elements in the array and skips the sibling of the node that was removed.

Fix PR:

You can test with:

const tree = new Tree();
tree.add('ceo');
tree.add('cto1', 'ceo');
tree.add('cto2', 'ceo');
tree.add('cto3', 'ceo');
tree.add('dev1', 'cto1');
tree.add('dev2', 'cto1');
tree.add('dev3', 'cto1');
tree.add('dev2', 'dev3');
tree.add('dev1', 'cto2');
tree.add('dev2', 'cto2');
tree.add('dev3', 'cto2');
tree.add('dev1', 'cto3');
tree.add('dev2', 'cto3');
tree.add('dev3', 'cto3');
tree.printByLevel();
tree.remove('dev2');
tree.printByLevel();

Priority Queue missing

There is no implementation of Priority Queue in this project.
Priority Queue is a very important data structure and it should be included in this project as well.

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.