码迷,mamicode.com
首页 >  
搜索关键字:for while until    ( 29426个结果
环形链表判断
方法一: 哈希表 时间复杂度:O(n) 空间复杂度:O(n) class Solution: def hasCycle(self, head: ListNode) -> bool: dict = {} while head: if head in dict: return True else: di ...
分类:其他好文   时间:2020-06-25 09:26:14    阅读次数:60
PTA 乙级 1001 害死人不偿命的(3n+1)猜想 (15分)
1 #include<stdio.h> 2 3 int main(){ 4 int n = 0; 5 int num = 0; 6 //printf("请输入一个不超过1000的正整数:"); 7 scanf("%d", &num); 8 while(num != 1){ 9 if(num%2 == ...
分类:其他好文   时间:2020-06-25 09:17:48    阅读次数:64
Java中的break和continue 区别
break可以离开当前switch、for、while、do while的程序块,并前进至程序块后下一条语句,在switch中主要用来中断下一个case的比较。在for、while与do while中,主要用于中断目前的循环执行。 注意:循环嵌套时只会跳出带break那层的循环,例如 1 class ...
分类:编程语言   时间:2020-06-24 23:50:02    阅读次数:67
各种排序算法
快速排序: void QuickSort(vector<int>& nums, int lo, int hi){ if(lo < hi){ int p = partition(nums,lo,hi); QuickSort(nums,lo,p-1); QuickSort(nums,p+1,hi); } ...
分类:编程语言   时间:2020-06-24 21:26:07    阅读次数:53
1016 Phone Bills
A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, dependi ...
分类:其他好文   时间:2020-06-24 18:10:26    阅读次数:58
检查hdfs文件块占用情况
批量执行检查脚本: #!/bin/bash file_name="$1" if [ -z "$file_name" ];then echo "Pls input file path" exit 1 fi cat "$file_name"| while read line do hadoop fsck ...
分类:其他好文   时间:2020-06-24 17:58:36    阅读次数:56
LeetCode 16. 最接近的三数之和
题目地址 16. 最接近的三数之和 题目分析 这个题和三数之和很相似,所以我采用了相同的做法,先进行排序,每次固定左手边的值。然后使用双指针从左边和右边寻找三数之和最接近target的值,这样做的效率有点差,两个月过去了水平还没啥提升,我醉了。 实现代码 class Solution { publi ...
分类:其他好文   时间:2020-06-24 13:50:47    阅读次数:36
不递归的方式更新所有用户的下属ID集合
/** * 批量更新xw_kefu的sonIds * @author jack */ function kefu_update_kefuids() { set_time_limit(0); global $db; $sql = "select id,name,p_id,is_lizhi from x ...
分类:其他好文   时间:2020-06-24 00:12:14    阅读次数:72
mysql中如何批量生成百万级数据
# 准备 #1. 准备表 create table s1( id int, name varchar(20), gender char(6), email varchar(50), first_name char(10), last_name char(10) ); #2. 创建存储过程,实现批量插 ...
分类:数据库   时间:2020-06-23 21:39:47    阅读次数:215
【MySQL】创建函数和存储过程,批量插入大数据
创建部门表和员工表 CREATE TABLE `dept` ( `id` int(11) NOT NULL AUTO_INCREMENT, `deptName` varchar(30) DEFAULT NULL, `address` varchar(40) DEFAULT NULL, `ceo` i ...
分类:数据库   时间:2020-06-23 21:21:06    阅读次数:89
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!