2016年12月26日
摘要: CentOS修改主机名 CentOS7和CentOS6.5 修改主机名的方法略有不同。 通过 hostname 命令可以查看当前的主机名。 1、 临时修改主机名 通过 'hostname 新的主机名' 命令可以设置主机名,但是这个方法在系统重启后就失效了。 2、 CentOS 6.5: 永久性修改主 阅读全文
posted @ 2016-12-26 11:28 HorseShoe2016 阅读(446) 评论(0) 推荐(0) 编辑
  2016年10月18日
摘要: 《C程序设计语言》练习题 5 10 编写程序 expr,计算从命令行输入的逆波兰表达式的值,其中每个运算符或操作数用一个单独的参数表示。例如,命令 expr 2 3 4 + 计算表达式2x(3+4)的值 算法实现 getfloat.c: // getfloat.c include include i 阅读全文
posted @ 2016-10-18 17:26 HorseShoe2016 阅读(1139) 评论(0) 推荐(0) 编辑
  2016年10月14日
摘要: 删除源文件注释语句的算法实现 面试某互联网公司,被问到“如何删除源文件中的注释语句?”,写了个很拙劣的算法,还没能考虑到“双引号中的//不用删除”这一环节。 写完后,面试官即说:“为什么不考虑用状态转换机呢?” 状态转换机?什么鬼?怎么用? 书到用时方恨少啊! 回去后赶紧网上搜索“状态转换机”、“删 阅读全文
posted @ 2016-10-14 11:49 HorseShoe2016 阅读(969) 评论(0) 推荐(0) 编辑
  2016年9月21日
摘要: 一道容易出错的C++笔试题 求下面代码的输出内容: int main(int argc,char argv[]) { char str1[]="Hello"; char str2="World"; cout 解析: str1指向的是字符串 "Hello" 的首地址,但 str1 同时也是一个字符数组 阅读全文
posted @ 2016-09-21 18:08 HorseShoe2016 阅读(229) 评论(0) 推荐(0) 编辑
  2016年9月14日
摘要: 1.首先确认服务器出于安全的状态,也就是没有人能够任意地连接MySQL数据库。 因为在重新设置MySQL的root密码的期间,MySQL数据库完全出于没有密码保护的 状态下,其他的用户也可以任意地登录和修改MySQL的信息。可以采用将MySQL对 外的端口封闭,并且停止Apache以及所有的用户进程 阅读全文
posted @ 2016-09-14 12:23 HorseShoe2016 阅读(156) 评论(0) 推荐(0) 编辑
  2016年9月12日
摘要: C++类的大小 (i) 如下代码: include using namespace std; class CBase { }; class CDerive :public CBase { }; int main(int argc, char argv[]) { CDerive p[3]; cout 阅读全文
posted @ 2016-09-12 13:16 HorseShoe2016 阅读(188) 评论(0) 推荐(0) 编辑
摘要: C++类的数组中构造函数和析构函数的调用顺序(2) 对于如下的代码: include using namespace std; class CBase { private: static int count; public: int id; public: CBase() { id = CBase: 阅读全文
posted @ 2016-09-12 13:02 HorseShoe2016 阅读(2478) 评论(0) 推荐(0) 编辑
摘要: 基类和派生类:构造函数和析构函数的执行顺序 在Visual Studio中,新建控制台工程,构造类如下: include using namespace std; class CBase { public: CBase() { cout Test.exe CBase():Constructor CD 阅读全文
posted @ 2016-09-12 12:00 HorseShoe2016 阅读(4400) 评论(0) 推荐(0) 编辑
  2016年9月7日
摘要: 在Android Studio中新建了一个 setting.xml 文件,布局好文件后,从 Text 界面切换到 Design 界面,显示了如下错误: 网上搜寻 The graphics preview in the layout editor may not be accurate ,还是没有解决 阅读全文
posted @ 2016-09-07 11:22 HorseShoe2016 阅读(2771) 评论(0) 推荐(0) 编辑
  2016年9月5日
摘要: 395. Longest Substring with At least K Repeating Characters Find the length of the longest substring T of a given string (consists of lowercase letter 阅读全文
posted @ 2016-09-05 22:18 HorseShoe2016 阅读(2842) 评论(1) 推荐(0) 编辑
摘要: 394. Decode String Given an encoded string, return it's decoded string. The encoding rule is: , where the encoded_string inside the square brackets is 阅读全文
posted @ 2016-09-05 22:07 HorseShoe2016 阅读(949) 评论(0) 推荐(0) 编辑
摘要: 393. UTF 8 Validation A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules: 1. For 1 byte character, the first bit is a 阅读全文
posted @ 2016-09-05 21:52 HorseShoe2016 阅读(662) 评论(0) 推荐(0) 编辑
摘要: 392. Is Subsequence Given a string s and a string t , check if s is subsequence of t . You may assume that there is only lower case English letters in 阅读全文
posted @ 2016-09-05 21:36 HorseShoe2016 阅读(1860) 评论(0) 推荐(0) 编辑
  2016年9月3日
摘要: 5. Longest Palindromic Substring Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, a 阅读全文
posted @ 2016-09-03 20:11 HorseShoe2016 阅读(147) 评论(0) 推荐(0) 编辑
  2016年9月1日
摘要: 391. Perfect Rectangle Given N axis aligned rectangles where N 0, determine if they all together form an exact cover of a rectangular region. Each rec 阅读全文
posted @ 2016-09-01 19:58 HorseShoe2016 阅读(822) 评论(0) 推荐(0) 编辑
  2016年8月30日
摘要: 390. Elimination Game There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afte 阅读全文
posted @ 2016-08-30 22:57 HorseShoe2016 阅读(982) 评论(1) 推荐(0) 编辑
  2016年8月29日
摘要: 问题描述 今天用Android Studio开发了一个简单的调用摄像头的App,结果想调试的时候发现选择调试设备的对话框中,手机名称后面总是跟着一个[OFFLINE]的标识,只能选择启动AVD来进行调试,但手机摄像头的App在AVD中是无法调试的。 网上找了很多解决方案: 1. 说是 adb 的版本 阅读全文
posted @ 2016-08-29 11:55 HorseShoe2016 阅读(5635) 评论(1) 推荐(0) 编辑
  2016年8月22日
摘要: 水平遍历二叉树 题目描述 对于一棵给定的二叉树: 1 / \ 2 3 / \ / \ 4 5 6 7 其水平遍历结果为: 1,2,3,4,5,6,7 算法分析 考虑使用队列来循环遍历该二叉树,首先将根节点放进队列中,循环判断队列是否为空,如果不为空, 则说明还有数据没有遍历到,所以取出队首节点,将队 阅读全文
posted @ 2016-08-22 16:25 HorseShoe2016 阅读(671) 评论(0) 推荐(0) 编辑
摘要: 中序遍历和后序遍历构造二叉树 题目描述 根据中序遍历和后序遍历构造二叉树 注意事项 你可以假设树中不存在相同数值的节点 样例 给出树的中序遍历: [1,2,3] 和后序遍历: [1,3,2] 返回如下的树: 2 / \ 1 3 算法分析: 给定同一课二叉树的中序和后序遍历数组,那么后序遍历数组的最后 阅读全文
posted @ 2016-08-22 16:05 HorseShoe2016 阅读(688) 评论(0) 推荐(0) 编辑
摘要: 子树 题目描述 有两个不同大小的二叉树:T1有上百万的节点;T2有好几百的节点。请设计一种算法,判定T2是否为T1的子树。 注意事项 若 T1 中存在从节点 n 开始的子树与 T2 相同,我们称 T2 是 T1 的子树。也就是说,如果在T1节点n处将树砍 断,砍断的部分将与T2完全相同。 样例 下面 阅读全文
posted @ 2016-08-22 15:58 HorseShoe2016 阅读(504) 评论(0) 推荐(0) 编辑