当前位置:网站首页>CPT 102_ LEC 16
CPT 102_ LEC 16
2022-06-11 02:50: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
see INT 102 LEC_03 Of 1.2 Binary Search
3. Cost of SortedArraySet with Binary Search
边栏推荐
- AOSP ~ WIFI默认开启 + GPS默认关闭 + 蓝牙默认关闭 + 旋转屏幕关闭
- How to add two factor authentication for WordPress websites
- 靠贴牌飞利浦冲击上市,德尔玛的自有品牌又该如何“起跳”?
- [AI weekly] AI and freeze electron microscopy reveal the structure of "atomic level" NPC; Tsinghua and Shangtang proposed the "SIM" method, which takes into account semantic alignment and spatial reso
- What can the enterprise exhibition hall design bring to the enterprise?
- 怎样简洁明了地说清楚产品需求?
- Prophet
- 年金保险理财产品可以复利吗?利率是多少?
- 年金保險理財產品可以複利嗎?利率是多少?
- CPT 102_LEC 20
猜你喜欢

Learning Tai Chi Maker - esp8226 (II)

What is ttfb

js 内存泄漏

Istio安装与使用

【大咖秀】博睿数据眼中的AIOps,选择正确的赛道正确的人

Istio installation and use

码农的进阶之路 | 每日趣闻

Uni app - one click access to user information

6 best WordPress Image optimizer plug-ins to improve WordPress website performance
![[MySQL 45 -10] Lesson 10 how MySQL selects indexes](/img/eb/dbde2852a89ece383266da1aeea862.jpg)
[MySQL 45 -10] Lesson 10 how MySQL selects indexes
随机推荐
[Fibonacci series]
OpenJudge NOI 1.13 18:Tomorrow never knows?
Navicat premium 15 tool is automatically deleted by anti-virus protection software solution
List 过滤、排序、校验等处理方法
Kotlin let method
Arduino使用NRF24L01模块进行无线通信
Android WiFi hide SSID configuration method
Kotlin apply method
年金保險理財產品可以複利嗎?利率是多少?
Problems with JDBC tool classes
Les produits financiers de l'assurance - rente peuvent - ils être composés? Quel est le taux d'intérêt?
年金保险理财产品可以复利吗?利率是多少?
js 内存泄漏
[AI weekly] AI and freeze electron microscopy reveal the structure of "atomic level" NPC; Tsinghua and Shangtang proposed the "SIM" method, which takes into account semantic alignment and spatial reso
AOSP ~ WiFi on by default + GPS off by default + Bluetooth off by default + rotary screen off
靠贴牌飞利浦冲击上市,德尔玛的自有品牌又该如何“起跳”?
20220610 星期五
你的公司会选择开发数据中台吗?
Why can some programmers get good offers with average ability?
【大咖秀】博睿数据眼中的AIOps,选择正确的赛道正确的人