Giter Site home page Giter Site logo

datastructures-algrithms's Introduction

数据结构与算法

  1. 包(Bag)
  2. 栈(Stack)
  3. 队列(Queue)
  4. 线性表(List)
  5. 迭代器(Iterator)
  6. 字典(Dictionary)
  7. 散列(Hash)
  8. 树(Tree)

包(Bag)

包是没有特定次序的对象的有限集合,包中可以包含重复项。

  1. +getCurrentSize(): integer 获取包中对象个数。
  2. +isEmpty(): boolean 查看包是否为空。
  3. +add(newEntry: T):boolean 添加对象newEntry到包中,并返回是否成功添加。
  4. +remove(): T 删除包中的任意一项,如果成功删除,则返回被删除项,否则放回null。
  5. +remove(anEntry: T): boolean 删除包中一个指定的项,如果有多项则删除首次出现的项,返回是否成功删除指定项。
  6. +clear(): void 清空包
  7. +getFrequency(anEntry: T): integer 返回指定项anEntry在包中出项的次数。
  8. +contains(anEntry: T): boolean 测试包中是否包含指定项anEntry。
  9. +toArray(): T[] 将包中的所有项转换成数组。

数组实现包

  1. -removeEntry(int index): T 删除包中指定位置的项。
  2. -getIndexOf(T: anEntry): integer 获取指定项在包中的位置,如果不存在则返回-1。

datastructures-algrithms's People

Contributors

dreamerking 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.