正版spring security實戰程式設計與
54.9元
(需用券)
去購買 >
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5SOxIGO5UzMjZ2MzYTNwEzMxY2YiNmM1YDO0MzY4UTNh9CX0JXZ252bj91Ztl2Lc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
當我們選擇資料結構的時候我們已經考慮下面幾點:
為什麼要選擇這種資料結構,資料結構的使用情況是什麼(簡而言之就是我們使用這種資料結構可以做到哪些優化), 進而我們需要考慮資料結構的接口,然後再考慮實作層面
1.資料結構裡存儲的資料形式是什麼
2.為什麼要使用這種資料結構
List of DataStructures:
ArrayList; LinkedList(Singly, Doubly); Queue(Circular Array, linkedList); Stack(array, singly LinkedList), Deque(Circular array, doubly linked list);
Tree(Balanced BST, augmented BST, segment Tree)
PriorityQueue vs TreeSet/Map
PriorityQueue:
O(1) for getting min/max heap
O(logn) for heap to offer;
O(logn) for remove
apis:
heapify(O(n)); percolateUp; percolateDown; poll; offer; peek;
The reason why we want to use tree set/map instead of heap is because the update index(which is not min/max) function in heap is difficult, and we should keep track of a hashmap to record the value and index.
優先隊列的優勢:get max/min, peek() is O(1)
TreeMap/Set的優勢: update or delete 任意number是O(logn)
If some problems can be solved by using priorityQueue, it must be solved by using treeset/map
TopKProblems
1.k Largest/Smallest Element in unsorted array
2.k smallest/largest element in unsorted array
3.The k closest points in 3-d space to point of (0,0,0)
原文連結:https://segmentfault.com/a/1190000012945769
java 11官方入門(第8版)教材
79.84元
包郵
(需用券)
去購買 >