Giter VIP home page Giter VIP logo

warehouseshuffle's Introduction

Warehouse Shuffle Problem

This was initially an assignment problem giving to me in my advanced algorithms course. Space and time complexity was a constraint. This is a java implementation of the problem. The problem was, given a depot (which is a warehouse only capable of containing 1 item), find a series of transfers between a set of warehouses, which allows the depot to get rid of its item.

Warehouses are constrained with a capacity as well as a defined list of item types it is able to contain.

My Implementation

In order to run in reasonable time (preferably O(n)) I thought of depth first search techniques which would only visit each node once. Furthermore, I wanted to use hashsets to make accessing the warehouses and item types much faster. Starting at a warehouse which has a capacity (room for an item), I then visit adjacent neighbours by first picking any one of the neighbours. The neighbour will only be chosen if:

    * The neighbour shares similar item types
    * The neighbour has one of those items to send

From here the neighbour procedes to send that item to the initial warehouse freeing up space. This is then done recursively marking each warehouse as visited, as to not visit the same warehouse, or infinitely loop, as well as base case returning when free space is made at a warehouse which shares item types with the depot

warehouseshuffle's People

Contributors

dospore avatar

Watchers

 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.