Skip to content

A small API that takes a list of unordered boarding passes, sorts them and output in a readable format.

Notifications You must be signed in to change notification settings

alahawash/TripSorter

Repository files navigation

TripSorter

A small API that takes a list of unordered boarding passes, sorts them and output in a readable format.

Installation

To install TripSorter, run the composer install command from the root directory of the project (make sure you have Composer installed):

php composer.phar install --prefer-dist

Assumptions

  • Input is read from a json file.
  • A train and a flight must have a seat assignment.

Run the application

The input file used for the application is "data/cards.json". To run the application:

php index.php

Unit Tests

Unit tests are located in the test folder. To run the tests:

./vendor/phpunit/phpunit/phpunit

Extending to new types

In order to introduce a new type of transportation with different characteristics, you only have to extend AbstractBoardingCard class.

Complexity

The sorting algorithm has a linear complexity of O(n).

About

A small API that takes a list of unordered boarding passes, sorts them and output in a readable format.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages