首页
关于
Search
1
牛客ACM输入输出特殊情况
150 阅读
2
时间复杂度与空间复杂度
143 阅读
3
实习日记 01 运行项目
110 阅读
4
常见判断输出的题
101 阅读
5
实习日记02 看项目首页源码
100 阅读
默认分类
实习
相关学习
算法
前端
登录
Search
Typecho
累计撰写
29
篇文章
累计收到
1
条评论
首页
栏目
默认分类
实习
相关学习
算法
前端
页面
关于
搜索到
3
篇与
的结果
2022-07-13
递归与动态规划
暴力递归1 汉诺塔问题---将数量为n的圆盘从最左边移动到最右边,必须小压大function fn(n){ if(n > 0){ func(n,left,right,mid) } function func(n,from,to,other){ if(n === 0){ console.log(1,from,to) } func(n - 1,from,other,to) console.log(n,from,other) func(n - 1,other,to,from) } }2 打印字符串的所有子序列(字串不一定连续,但是相对顺序不能乱)function fn(str){ let arr = str.split('') let ans = [] let path = '' func(arr,0,ans,path) return ans function func(arr,index,ans,path){ if(index === arr.length){ ans.push(path) return } let no = path func(arr,index + 1,ans,path) let yes = path + arr[index] func(arr,index + 1,ans,path) } }
2022年07月13日
53 阅读
0 评论
0 点赞
2022-06-10
链表
反转链表反转链表主要是靠三个指针,pre指向前一个指针,cur和next指向当前指针,保持这个顺序就可以。function ReverseList(node){ let pre = null let cur = node let next = node while(cur.next != null){ next = cur.next cur.next = pre pre = cur cur = next } return pre }
2022年06月10日
66 阅读
0 评论
0 点赞
2022-06-10
时间复杂度与空间复杂度
时间复杂度多个复杂度看最高的复杂度,常数也要去掉if,加减乘除都是O(1),O(1)一般被忽略for循环和while循环是O(n),嵌套的循环是O(n平方),但是如果是两个for循环就还是O(n)二分搜索是O(logn)用到了排序就是O(nlogn)时间复杂度就是看自己有没有创建空间
2022年06月10日
143 阅读
0 评论
0 点赞