Git Product home page Git Product logo

moeenh / transport-using-bst Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 2.74 MB

This is a bus stop service powered by binary search trees, linked lists, and arrays. It offers sorted bus stop lists and route viewing options, leveraging efficient data structures for insertion and search operations. The project optimizes time complexity and memory utilization, providing a seamless user experience.

Java 100.00%
binarysearchtree data-structures java linked-list project

transport-using-bst's Introduction

Transport-using-BST

Bus Stop Service

  • The project consists of a search engine that utilizes three Data Structures, namely: Binary Trees, Linked List & Array.
  • The user can access the Bus Stop lists sorted according to the distance from university in ascending order.
  • Another feature would be the option to view all the routes of a particular Bus stop by entering it’s name via user input at run-time.
  • The name, location, distance, & it’s routes are all stored accordingly.
  • Arrays are used in order to ensure that the user can access the routes of each bus stop via user input.

BusNode

  • LEFT
  • RIGHT
  • NAME
  • LOCATION
  • DISTANCE
  • Link List of Routes

Usage of Array

  • After the InOrder traversal that prints out every single Bus Stop’s information, we have the option to access one of these to view it’s routes.
  • In order to ensure that the information is available even after the traversal is done, we place these Bus nodes within an array. We then take user input of any one number, and whatever number is entered, the bus stop corresponding to that number has it’s information displayed.

Why BST ?

  • The insertion & search of the binary tree yields more than satisfactory time complexity.
  • A Binary Tree would’ve worked for the route as well, but for the ease of implementation & because we knew the number of routes wouldn’t be particularly high, we used a LinkedList.
  • We use a Binary Tree in order to store the Bus Nodes. A hashing table would’ve made it impossible to implement any sorting algorithms. A LinkedList’s time complexity would’ve been a major drawback.
  • We utilize a LinkedList to store the routes. An array would’ve wasted memory since the number of routes is not pre-defined.

Complextity Analysis

Function O(N)
InsertByDistance O(Log(N))
ArrayCreation O(1)
InOrderTraversal O(N)
Insert O(N)
ToString O(N)
Find O(N)

Output

image1 image2

img3 img4

transport-using-bst's People

Contributors

moeenh avatar

Watchers

 avatar  avatar

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.