Coder Social home page Coder Social logo

ugurkap / algorithm-implementations Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 1.01 MB

Insertion Sort, Quick Sort, Merge Sort, Min Heap, Priority Queue, Red Black Tree, Order Statistic Tree, Graph Creation, Breadth-First and Depth-First Search and Homework Assignments

C++ 47.72% CMake 20.27% C 21.83% Makefile 10.18%
cpp algorithms data-structures insertion-sort quick-sort merge-sort red-black-tree order-statistic-tree min-heap algorithm-implementations

algorithm-implementations's People

Contributors

mrgranddy avatar ugurkap avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

algorithm-implementations's Issues

Order Statistic Tree Sizes

After deleting a node, some of the nodes seem to have wrong sizes. So, order statistic tree is useless after deleting an element as it is.

So, I have to review what is wrong with delete and transplant functions.

Issue with RBTree::Delete

If the tree had only one node, and if you would delete that single node, RBTree:Delete should set the root node to the null pointer. So the suggest modification would be to add the following conditional statement between lines 264 and 265 of OrderStatisticTree.cpp:

if (node == root) {
root = nullptr;
return;
}

p.s. You may wonder why a random person would suddenly try to debug your old code. The reason is that I need to use order statistic trees for my C++ project without access to the GNU policy-based data structures. Yours was one of the few order statistic tree implementations without a major error that I could fine online.

RBTree::Delete

In lines 282 and 291 of OrderStatisticTree.cpp, temp->parent should be changed to temp.

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.