/cw-UCB-cs61b-18spring

Data Structures in Java

Primary LanguageJava

cw-UCB-cs61b-17spring

Data Structures in Java

Summary of rules in Java MAINly:

  1. 2 common approaches to implement a sequence ds: Array provided by java and Linked nodes.
  2. BST: extended the idea of linked nodes to implement a tree data structure.
  3. Hashmap.resize(int cap)的cap不能设置为DEFAULT_SIZE*2(常量式地翻倍),而是buckets.当前length, 是变量:(因为根据定义是这样扩容的,test case是也是根据后者来定义的)
  4. 抽象的结构上,Binary min-heaps are basically just abstract binary Complete trees (but not BST), but abstract tree's implementation is still Array;既然是tree ADT, swim/bubble方法和sink方法不一样,前者是向上比,node和唯一的parent比较,而sink是向下,因为binary的性质,会有俩node所以是parent和left right node中min的swap,多了一次取min