【文件属性】:
文件名称:leetcode添加元素使和等于-LeetCode:力扣唱片
文件大小:164KB
文件格式:ZIP
更新时间:2021-06-30 06:40:54
系统开源
leetcode添加元素使和等于
LeetCode
LeetCode
Record
归并快排的区别:
思想不同:归并从局部到整体,快排从整体到局部
稳定性:归并是稳定排序,快排不是稳定排序
运行时间:归并
$\Theta(n)logn$,快排只是平均情况下为
nlogn,但是快排的系数要小一点
空间复杂度:对于数组来说,快排可以O(1),而归并需要O(n);对于链表来说则都是O(1)
2020/5/23
268.
Missing
Number
位图法。给定从
0
~
n
之间选取的
n
个不同的数。要求找到其中的
missing
number。
解释直接抄LeetCode评论区了
For
people
who
don't
understand
this
solution:
what
he's
doing
is
he's
using
the
bitwise
XOR
operator
to
single
out
the
missing
number.
How?
First,
we
need
to
understand
the
properties
of
XOR:
firstly,
XOR'