The following challenges are addressed in the build:
- Setting up a repository on Github that automatically runs tests for every time you push e.g. with Travis-CI
- Implementing the binary search tree insert operation in the language of your choice (at Motorola we use the language Elixir a lot)
- Optional challenge: implement a REST API for the insert operation. If you choose Elixir as your programming language, use Plug.
- Optional challenge: dockerize your application, deploy on Kubernetes and set-up ingress. You can use a free service such as e.g. kubesail.com.
This build is a REST API implementation of Binary Search Tree (BST) insertion opertation using Elixir and Plug dockerized and deployed with kubernetes GitHub checks are powered by Travis-CI and the results of the every commit on the repository can be seen at https://travis-ci.com/github/SaipranavK/motorola-student-worker-challenge
The docker image of this build can be pulled using the command:
docker pull saipranavk/binary-search-tree
available on DockerHub at https://hub.docker.com/r/saipranavk/binary-search-tree or
To run the docker image use command:
docker run saipranavk/binary-search-tree
or you can directly access the API at https://binary-search-tree.saipranavk.usw1.kubesail.org/
Following are the Endpoints available in the API
-
GET: "/" - Generic test route to check if the server is running
Response: "Binary Search Tree REST API" with status code 200 -
POST: "/insert" - Route to create tree/add new node
Payload: { "tree": tree, "n": n } where, n is the value to be added. To create a new tree pass "tree": null/nil.
Response: tree with status code 200
Sample POSTMAN request are attached below for reference:
To create a new tree with n as root element
To add a new element to an exisiting tree
n must be an interger. Invalid key value pair of n will return with response
Invalid payload will return
Author : Saipranav Koyyada (ksaipranav@gmail.com)
https://www.linkedin.com/in/saipranavkoyyada/
Please feel free to contact for any queries or feedback.