03 2016 档案
摘要:问题一:单链表反转,提供空间复杂度O(1),时间复杂度O(n), 解法:利用三个指针遍历一遍,下面用图来阐释。 图1,初始情况,给定head指针,链表末尾指向NULL。 图2,创建三个节点指针,分别为p指向head,q指向p->next,r指向q->next。并且将p指向NULL,因为逆转链表之后,
阅读全文
摘要:需求:模拟登录知乎,因为知乎首页需要登录才可以查看,所以想爬知乎上的内容首先需要登录,那么问题来了,怎么用python进行模拟登录以及会遇到哪些问题? 前期准备: 环境:ubuntu,python2.7 需要的包:requests包、正则表达式包 安装requests:pip install req
阅读全文
摘要:一、定义1. 作用:对象消亡时,自动被调用,用来释放对象占用的空间2.特点: (1) 名字与类名相同 (2) 在前面需要加上"~" (3) 无参数,无返回值 (4) 一个类最多只有一个析构函数 (5) 不显示定义析构函数会调用缺省析构函数 二、用法1.普通用法 代码: 结果: 分析: 在main函数
阅读全文
摘要:一、安装:在之前的博客中已经写过:http://www.cnblogs.com/puyangsky/p/4763234.html 二、python数组切片知识: python中序列类有list、string、tuple、buffer、unicode等,它们都支持index, len, max, mi
阅读全文
摘要:原题: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tre
阅读全文
摘要:(1)进程运行时能够访问哪些资源或文件,不取决于进程文件的属主属组,而是取决于运行该命令的用户身份的uid/gid,以该身份获取各种系统资源。 (2)对一个属主为root的可执行文件,如果设置了SUID位,则其他所有普通用户都将可以以root身份运行该文件,获取相应的系统资源。 (3)可以简单地理解
阅读全文
摘要:原题: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exi
阅读全文
摘要:Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have ex
阅读全文
摘要:Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive intege
阅读全文
摘要:用法:void func(int param1, int param2 = 1, int param = 3) {} func(10); //等同于func(10, 1 , 3) func(10,8); //等同于func(10, 8, 3) func(10, , 3);//编译错误,只能最右边的连
阅读全文
摘要:直接上代码: #include<stdio.h> #include<string> #include<iostream> using namespace std; class Student { private: int age; string name; public: Student(int,
阅读全文
摘要:用法: const int & a; 定义了一个整型常引用变量a。 特点: 1、不能够通过常引用变量来修改其值,如: const int & a = 10; a = 12;//编译报错! 2、可以通过非常引用变量给常引用变量赋值,反之则不行。 const int & a = 10; int & b
阅读全文

浙公网安备 33010602011771号