当前位置:网站首页>CPT 102_LEC 16
CPT 102_LEC 16
2022-06-11 01:52:00 【NONE_WHY】
1. Cost of ArraySet operations
1.1. ArrayList costs
Get O (1) Set O (1) Remove O (n) Add (at i) O (n) worst & average Add (at end) O (1) most of the time O (n) worst O (1) amortised average
1.2. ArraySet costs
1.2.1. Features
- Order is not significant
- ⇒ add() can choose to put a new item anywhere
- ⇒ can reorder when removing an item
- Duplicates not allowed
- ⇒ must check if item already present before adding
1.2.2. Algorithms
- Contains(value)
search through array, if value equals item return true return false
- Add(value)
if not contains(value), place value at end, (doubling array if necessary) increment size
- Remove(value)
search through array if value equals item replace item by item at end. (why?) decrement size return
2. Binary Search
见INT 102 LEC_03 的 1.2 Binary Search
3. Cost of SortedArraySet with Binary Search
边栏推荐
- 889. 根据前序和后序遍历构造二叉树
- Modify release opening animation
- Can annuity insurance financial products be compounded? What is the interest rate?
- Li Kou brushing questions - hash table
- 421. maximum XOR value of two numbers in the array
- Metal organic framework materials (fe-mil-53, mg-mof-74, ti-kumof-1, fe-mil-100, fe-mil-101) supported on isoflurane / methotrexate / doxorubicin (DOX) / paclitaxel / ibuprofen / camptothecin
- MySQL备份与恢复
- Principle of everything for fast search
- 10 years of domestic milk powder counter attack: post-90s nannies and dads help new domestic products counter attack foreign brands
- [untitled]
猜你喜欢

如何保障数仓数据质量?

C language principle explanation and code implementation of scalable / reduced thread pool

SQL | calculate sum

MOFs, metal organic framework materials of folic acid ligands, are loaded with small molecule drugs such as 5-fluorouracil, sidabelamine, taxol, doxorubicin, daunorubicin, ibuprofen, camptothecin, cur

2022 safety officer-b certificate examination question bank and answers

Limiting visibility of symbols when linking shared libraries

The most complete format description of clang format

Tests logiciels vocabulaire commun anglais

How to read PMBOK guide in 3 steps (experience + data sharing)

Unity animator rewind
随机推荐
Optimized dispatching (thermal power, wind energy and energy storage) [matlab code implementation]
年金保險理財產品可以複利嗎?利率是多少?
Kotlin apply method
【面试题 17.04. 消失的数字】
STC8A8K64D4 EEPROM读写失败
Multilevel mesoporous organometallic framework material zif-8 loaded with lactic acid oxidase (LOD) / ferric oxide (Fe304) / doxorubicin / insulin /cas9 protein / metronidazole / emodin methyl ether
1031. maximum sum of two non overlapping subarrays
Koa2 learning notes
2022 simulated 100 questions and answers for crane driver (limited to bridge crane) examination
SQL | 计算总和
Project - redis message queue + worker thread fetches user operation logs and stores them (2)
Why can some programmers get good offers with average ability?
378. the k-th smallest element in an ordered matrix
[parallel and distributed systems] cache learning
Learning Tai Chi Maker - esp8226 (II)
Byte beating client R & D Intern Tiktok side
13. numeric array
动态给对象添加属性
Unity HTC and Pico are the same
Bingbing learning notes: find the greatest common divisor and the least common multiple. Complex version reverse string