Git Product home page Git Product logo

tree's People

Contributors

apasel422 avatar kodraus avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

tree's Issues

Add tests

Every method should have quickcheck tests.

Add iter_mut

There's a method in Vec called iter_mut(). It is essentially iter() but with mutable references.

Morris Traversal - Inorder Tree Traversal without recursion and without stack

Would it be possible to implement an iterator using Morris Traversal?

Using Morris Traversal, we can traverse the tree without using stack and recursion. The idea of Morris Traversal is based on Threaded Binary Tree. In this traversal, we first create links to Inorder successor and perform the inorder-operation on the data using these links, and finally revert the changes to restore original tree.

http://www.geeksforgeeks.org/inorder-tree-traversal-without-recursion-and-without-stack/

As tree is modified through the traversal, it might be necessary to implement Drop-Trait for Map or Set, to ensure the tree is restored even if iterator does not reach the "end".

Implement comparison traits

TreeMap should implement {PartialEq, Eq, PartialOrd, Ord}, but this needs to be reconciled with comparators.

Add examples

  • Map::max_entry
  • Map::min_entry
  • Map::pred_entry
  • Map::succ_entry
  • Set::entry
  • Set::max_entry
  • Set::min_entry
  • Set::pred_entry
  • Set::succ_entry

Add examples

  • TreeMap::pred_mut
  • TreeMap::pred_or_eq_mut
  • TreeMap::succ_mut
  • TreeMap::succ_or_eq_mut

Conflicting methods `min` and `max` on `Set` and `Map`

In rust-lang/rust#42496, methods min and max were added to the Ord trait.

These methods are shadowing the inherent min and max on Set and Map (see: rust-lang/rust#43682), and unfortunately don't have the same signature, and there doesn't seem to be a single obvious fix for tree.

The easiest thing to do is rename Map.min/max and Set.min/max or just remove those methods. It might also be possible to design around the issue by exposing the min and max functions on a type that doesn't implement Ord. Maybe something like Map.find().min() and Map.find_mut().min()?

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.