Skip to content

Commit

Permalink
chore: 基础数据结构部分增加少量描述文字
Browse files Browse the repository at this point in the history
  • Loading branch information
luzhipeng committed Jul 10, 2019
1 parent 73ae999 commit 582d66f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions thinkings/basic-data-structure-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The non-linear structure contains tree, graph and so on.
It should be noted that, the linear and non-linear date structures do NOT mean that the data in those structure are stored in a linear or non-linear on the hard disk. It is just a logic partition. For example, binary tree can be stored in array.

Generally speaking, the data structure which has `pre` and `next` is linear.
Such as Array and Linked List, actually the Linked List is a kind of `Single Tree`
### Array

Array is the simplest data structure and is used in so many places. For example, array is perfectly appropriate to store a data list. And in fact, you can find array behind many other data structures.
Expand Down Expand Up @@ -306,6 +308,9 @@ BTW, you can find more details and algorithms in the charpter [binary tree trave

Heap is a kind of priority queue which is built in many data structure. But unfortunately, JS does not have a native implementation of this data structure. However, it won't be a problem for understanding and using this structure.

Note that: heap is not the only implementation of `priority queue`, there're a lot of more complex
implementations

Related algorithm:

- [295.find-median-from-data-stream](../problems/295.find-median-from-data-stream.md)
Expand Down
4 changes: 4 additions & 0 deletions thinkings/basic-data-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
需要注意的是,线性和非线性不代表存储结构是线性的还是非线性的,这两者没有任何关系,它只是一种逻辑上的划分。
比如我们可以用数组去存储二叉树。

一般而言,有前驱和后继的就是线性数据结构。比如数组和链表。其实一叉树就是链表。
### 数组

数组是最简单的数据结构了,很多地方都用到它。 比如有一个数据列表等,用它是再合适不过了。
Expand Down Expand Up @@ -305,6 +307,8 @@ return, children, sibling也都是一个fiber,因此fiber看起来就是一个
堆其实是一种优先级队列,在很多语言都有对应的内置数据结构,很遗憾javascript没有这种原生的数据结构。
不过这对我们理解和运用不会有影响。

需要注意的是优先队列不仅有堆一种,还有更复杂的,但是通常来说,我们会把两者做等价。

相关算法:

- [295.find-median-from-data-stream](../problems/295.find-median-from-data-stream.md)
Expand Down

0 comments on commit 582d66f

Please sign in to comment.