https://leetcode.com/problems/find-the-duplicate-number/#/description ...
分类:
其他好文 时间:
2017-06-09 09:54:41
阅读次数:
158
public static boolean hasCycle(ListNode head) { if (head == null || head.next == null) { return false; } ListNode slow = head; ListNode fast = head.ne... ...
分类:
其他好文 时间:
2017-06-08 14:03:35
阅读次数:
231
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For ...
分类:
其他好文 时间:
2017-06-08 00:23:39
阅读次数:
140
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? 若在while开始时判断fast==slow,会出现误判,即第一次循环时fast ...
分类:
其他好文 时间:
2017-06-08 00:10:16
阅读次数:
289
题目 一个链表中包含环,请找出该链表的环的入口结点。 分析 首先检查该链表是否为环,设置一个快指针fast,每次走两步,一个慢指针slow,每次走一步。若fast==null或fast.next==null,表示不存在环;当fast==slow时,存在环。 将fast指向链表头,每次走一步,slow ...
分类:
其他好文 时间:
2017-06-06 15:58:36
阅读次数:
137
1.慢查询有什么用? 能记录下所有执行超过long_query_time时间的SQL语句, 帮你找到执行慢的SQL, 方便我们对这些SQL进行优化. 2. 如何开启慢查询? 首先我们先查看MYSQL服务器的慢查询状态是否开启. 我们可以看到当前log_slow_queries状态为OFF, 说明当前 ...
分类:
数据库 时间:
2017-06-06 15:50:11
阅读次数:
188
这里我以mysql查询日志为源文件输入,直接显示到网页中查看。<?php
$file=‘mysqld-slow.log‘;
$fp=fopen($file,"r");
$line=5000;
$pos=-2;
$t="";
$data="";
while($line>0)
{
while($t!="\n")
{
$flag=fseek($fp,$pos,SEEK_END);
if(fseek($fp,$pos,SEEK_END)==-1){
re..
分类:
Web程序 时间:
2017-06-05 14:21:49
阅读次数:
179
1.介绍一下MYSQL经常使用的优化技巧. MySQL 自带 slow log 的分析工具 mysqldumpslow ,可是没有说明。本文通过分析该脚本,介绍了其用法。 slow log 是 MySQL 依据 SQL 语句的运行时间设定,写入的一个文件,用于分析运行较慢的语句。 仅仅要在 my.c ...
分类:
数据库 时间:
2017-06-04 13:48:06
阅读次数:
218
最近在学习Hadoop,开始做一个集群。由于各个节点的IP地址需要保持不变,我决定在VMWare采用NAT的模式联网。 但是在安装Ubuntu系统的时候,提示我DHCP服务未开启。 Your network is probably not using the DHCP protocol. Alter ...
分类:
系统相关 时间:
2017-06-03 12:36:07
阅读次数:
588
141. Linked List Cycle 题目链接:https://leetcode.com/problems/linked-list-cycle/#/description 题目大意:给定一个链表,判断是否有环,要求不能申请额外的空间 思路:使用快慢指针。fast指针一次移动两步,slow指针 ...
分类:
其他好文 时间:
2017-06-03 09:50:25
阅读次数:
203