Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lazyn
Fucking Algorithm
提交
4acb8f3c
F
Fucking Algorithm
项目概览
lazyn
/
Fucking Algorithm
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Fucking Algorithm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
4acb8f3c
编写于
3月 12, 2023
作者:
L
labuladong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update content
上级
2a4efc4f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
4 addition
and
1 deletion
+4
-1
pictures/plugin/全家桶.jpg
pictures/plugin/全家桶.jpg
+0
-0
pictures/全家桶.jpg
pictures/全家桶.jpg
+0
-0
数据结构系列/队列实现栈栈实现队列.md
数据结构系列/队列实现栈栈实现队列.md
+1
-0
算法思维系列/常用的位操作.md
算法思维系列/常用的位操作.md
+3
-1
未找到文件。
pictures/plugin/全家桶.jpg
查看替换文件 @
2a4efc4f
浏览文件 @
4acb8f3c
144.5 KB
|
W:
|
H:
389.7 KB
|
W:
|
H:
2-up
Swipe
Onion skin
pictures/全家桶.jpg
0 → 100644
浏览文件 @
4acb8f3c
389.7 KB
数据结构系列/队列实现栈栈实现队列.md
浏览文件 @
4acb8f3c
...
...
@@ -20,6 +20,7 @@
|
[
225. Implement Stack using Queues
](
https://leetcode.com/problems/implement-stack-using-queues/
)
|
[
225. 用队列实现栈
](
https://leetcode.cn/problems/implement-stack-using-queues/
)
| 🟢
|
[
232. Implement Queue using Stacks
](
https://leetcode.com/problems/implement-queue-using-stacks/
)
|
[
232. 用栈实现队列
](
https://leetcode.cn/problems/implement-queue-using-stacks/
)
| 🟢
| - |
[
剑指 Offer 09. 用两个栈实现队列
](
https://leetcode.cn/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/
)
| 🟢
| - |
[
剑指 Offer 09. 用两个栈实现队列
](
https://leetcode.cn/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/
)
| 🟢
**-----------**
...
...
算法思维系列/常用的位操作.md
浏览文件 @
4acb8f3c
...
...
@@ -27,7 +27,7 @@
位操作(Bit Manipulation)可以有很多技巧,有一个叫做 Bit Twiddling Hacks 的网站收集了几乎所有位操作的黑科技玩法,网址如下:
http://graphics.stanford.edu/~seander/bithacks.html
#ReverseParallel
http://graphics.stanford.edu/~seander/bithacks.html
但是这些技巧大部分都过于晦涩,我觉得可以作为字典查阅,没必要逐条深究。但我认为那些有趣的、有用的位运算技巧,是我们每个人需要掌握的。
...
...
@@ -126,6 +126,8 @@ while (true) {
// 输出:1,2,3,4,1,2,3,4,1,2,3,4...
```
> note:注意这个技巧只适用于数组长度是 2 的幂次方的情况,比如 2、4、8、16、32 以此类推。至于如何将数组长度扩展为 2 的幂次方,这也是有比较巧妙的位运算算法的,可以参考 https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
简单说,
`& (arr.length - 1)`
这个位运算能够替代
`% arr.length`
的模运算,性能会更好一些。
那问题来了,现在是不断地
`index++`
,你做到了循环遍历。但如果不断地
`index--`
,还能做到环形数组的效果吗?
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录