tqc-michalp / tree-of-nodes-api Goto Github PK
View Code? Open in Web Editor NEWtree-of-nodes-api is a Ruby on Rails application that serve data about nodes and birds.
tree-of-nodes-api is a Ruby on Rails application that serve data about nodes and birds.
Your issue may already be reported! Please search on the issue tracker before creating one.
It seems that the logic processing by CommonAncestorService for issue number #2 is returning incorrect results
Implement specs from the issue description #2 to ensure the logic is correct.
Your issue may already be reported! Please search on the issue tracker before creating one.
n/a
Nodes have_many :birds
and birds belongs_to :node
.
Endpoint should take an array of node ids and return the ids of the birds that belong to one of those nodes or any descendant nodes.
n/a
n/a
Your issue may already be reported! Please search on the issue tracker before creating one.
Currently data is in db/seeds/nodes.csv
file. We need them to be persisted in database.
The objective of this feature request is to allow the storage of dynamic data in database to facilitate efficient retrieval and updating of data.
To achieve this, we will need to design a database schema then create migration to seed the database. Model should be named: Node
.
n/a
n/a
Your issue may already be reported! Please search on the issue tracker before creating one.
n/a
The /common_ancestor
endpoint is used to find the lowest common ancestor of two given nodes in a tree. This endpoint requires two parameters, namely a
and b
, and returns three pieces of information about the lowest common ancestor. These include the root_id
of the tree, the lowest_common_ancestor_id
of the two nodes, and the depth of the lowest common ancestor in the tree. By providing these details, the /common_ancestor
endpoint enables users to efficiently determine the relationship between any two nodes in a tree structure.
For example, given the data for nodes:
id | parent_id
---------+-----------
125 | 130
130 |
2820230 | 125
4430546 | 125
5497637 | 4430546
/common_ancestor?a=5497637&b=2820230 should return
{root_id: 130, lowest_common_ancestor: 125, depth: 2}
/common_ancestor?a=5497637&b=130 should return
{root_id: 130, lowest_common_ancestor: 130, depth: 1}
/common_ancestor?a=5497637&b=4430546 should return
{root_id: 130, lowest_common_ancestor: 4430546, depth: 3}
if there is no common node match, return null for all fields
/common_ancestor?a=9&b=4430546should return
{root_id: null, lowest_common_ancestor: null, depth: null}
if a==b, it should return itself
/common_ancestor?a=4430546&b=4430546 should return
{root_id: 130, lowest_common_ancestor: 4430546, depth: 3}
n/a
n/a
n/a
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.