42
42
- because when array is full, resizing takes O(n) time
43
43
44
44
## python
45
- # list
45
+ - list
46
46
``` python
47
47
# list
48
48
@@ -339,7 +339,7 @@ sl = SortedList([10, 11, 12, 13, 14])
339
339
sl.bisect_left(12 ) # 2
340
340
```
341
341
342
- # dict
342
+ - dict
343
343
``` python
344
344
# dict
345
345
@@ -498,7 +498,7 @@ idx = sd.bisect_left(25)
498
498
print (idx) # 3
499
499
```
500
500
501
- # set
501
+ - set
502
502
``` python
503
503
# set
504
504
@@ -573,7 +573,7 @@ s3 = s1.symmetric_difference(s2)
573
573
print (s3) # {1, 2, 4, 5}
574
574
```
575
575
576
- # tuple
576
+ - tuple
577
577
``` python
578
578
# tuple
579
579
@@ -594,7 +594,7 @@ t = tuple(["a", "b", "c"]) # ('a', 'b', 'c')
594
594
t = (" abc" ,) # ('abc',)
595
595
```
596
596
597
- # heap
597
+ - heap
598
598
``` python
599
599
# heap
600
600
@@ -629,7 +629,7 @@ heapify(list2)
629
629
print (list2) # [-9, -7, -5, -1, -3]
630
630
```
631
631
632
- # queue
632
+ - queue
633
633
``` python
634
634
# queue
635
635
# in Python, list can be used as stack
@@ -674,7 +674,7 @@ queue2.popleft() # c
674
674
# extend() is O(k), add multiple values
675
675
```
676
676
677
- # number
677
+ - number
678
678
``` python
679
679
# number
680
680
@@ -962,7 +962,7 @@ print(sqrt(5)) # 2.23606797749979
962
962
print (int (sqrt(5 ))) # 2
963
963
```
964
964
965
- # string
965
+ - string
966
966
``` python
967
967
# string
968
968
@@ -1083,7 +1083,7 @@ s = '0'
1083
1083
s = ' 1' + s + ' 1' # '101'
1084
1084
```
1085
1085
1086
- # class
1086
+ - class
1087
1087
``` python
1088
1088
# class
1089
1089
@@ -1187,7 +1187,7 @@ outer()
1187
1187
1188
1188
## java
1189
1189
1190
- # Array
1190
+ - Array
1191
1191
``` Java
1192
1192
package ArraySyntax ;
1193
1193
@@ -1373,7 +1373,7 @@ public class Main {
1373
1373
1374
1374
```
1375
1375
1376
- # ArrayList
1376
+ - ArrayList
1377
1377
``` Java
1378
1378
package ArrayListSyntax ;
1379
1379
@@ -1559,7 +1559,7 @@ public class Main {
1559
1559
1560
1560
```
1561
1561
1562
- # HashMap
1562
+ - HashMap
1563
1563
``` Java
1564
1564
package HashMapSyntax ;
1565
1565
@@ -1724,7 +1724,7 @@ public class Main {
1724
1724
1725
1725
```
1726
1726
1727
- # HashSet
1727
+ - HashSet
1728
1728
``` Java
1729
1729
package HashSetSyntax ;
1730
1730
@@ -1805,7 +1805,7 @@ public class Main {
1805
1805
1806
1806
```
1807
1807
1808
- # PriorityQueue
1808
+ - PriorityQueue
1809
1809
``` Java
1810
1810
package PriorityQueueSyntax ;
1811
1811
@@ -1876,7 +1876,7 @@ record FreqWord(String content, Integer freq) { }
1876
1876
1877
1877
```
1878
1878
1879
- # ArrayDeque
1879
+ - ArrayDeque
1880
1880
``` Java
1881
1881
package ArrayDequeSyntax ;
1882
1882
@@ -1975,7 +1975,7 @@ record Pair(TreeNode node, int level) { };
1975
1975
1976
1976
```
1977
1977
1978
- # String
1978
+ - String
1979
1979
``` Java
1980
1980
package StringSyntax ;
1981
1981
@@ -2187,7 +2187,7 @@ public class Main {
2187
2187
2188
2188
```
2189
2189
2190
- # TreeMap
2190
+ - TreeMap
2191
2191
``` Java
2192
2192
package TreeMapSyntax ;
2193
2193
@@ -2327,7 +2327,7 @@ public class Main {
2327
2327
2328
2328
```
2329
2329
2330
- # Number
2330
+ - Number
2331
2331
``` Java
2332
2332
package NumberSyntax ;
2333
2333
0 commit comments