Giter VIP home page Giter VIP logo

interview-trains's Introduction

Interview question: Trains

运行步骤

  • 目前只提供从 txt 文件中读取数据,文件默认存放路径在 class 下的 data.txt 文件,数据格式「AB3」
  • 运行 Application 的「main()」方法,可以得到题目答案

分析

步骤

  1. 分析
  2. 构建图数据结构
  3. 设计
  4. 实现与优化

设计思路

  • 划分输入,核心和输出三个解耦模块,提供接口,面向接口编程。
  • 使用工厂方法,创建不同结构的图模型。
  • 可以提供配置不同的输入和输出策略,处理数据。
  • 考虑线程问题,第一个版本只处理单线程情况,也先不考虑缓存问题。
  • 第一版都使用「邻接表」构建图,处理问题,1-5题可以使用「邻接矩阵」的结构更好

需要考虑的点以及可优化的点

  • 线程问题,目前这个版本非线程安全
  • 缓存问题
  • 抽象封装优化,递归参数的封装

目前对于解决这类问题的方案

interview-trains's People

Contributors

zhouzgang avatar

Watchers

James Cloos 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.