在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。1、 基本操作(1)头文件 #include.(2)创建vector对象 vector vec;(3)尾部插入数字 vec.push_back(a);(4)使用下标访问元素 cout::iterator it;for(i...
分类:
编程语言 时间:
2015-07-09 16:05:04
阅读次数:
114
双调排序
分类:
编程语言 时间:
2015-07-09 16:04:00
阅读次数:
166
>>> def power(x): ... return x*x ... >>> power(5) 25 >>> def power(x,n): ... s=1 ... while n >0: ... n = n -1 ... s = s*x ... return s ... >>> power(5,2) 25 >>> power(5,3) 125...
分类:
编程语言 时间:
2015-07-09 15:00:54
阅读次数:
162
今天做的项目中遇到了获取map中根据key进行排序的value数据,key中保存的内容是字符串类型。map的知识点好久没用有点生疏,不知道怎么去使用。看看之前同事写的map根据key排序的代码,发现他是先把key都取出来封装到一个List中,然后用Collections.sort方法对List排序,按照排..
分类:
编程语言 时间:
2015-07-09 14:59:27
阅读次数:
148
大招list[list.index("haha")]="2222"创建列表sample_list=[‘a‘,1,(‘a‘,‘b‘)]Python列表操作sample_list=[‘a‘,‘b‘,0,1,3]得到列表中的某一个值value_start=sample_list[0]end_value=sample_list[-1]删除列表的第一个值delsample_list[0]在列表中插入一个值sample_list[0:0]=[‘s..
分类:
编程语言 时间:
2015-07-09 14:56:26
阅读次数:
133
下面是个人感觉比较清晰易懂的spring实现RMI的网络帖子:使用Spring对RMI的支持,可以非常容易地构建你的分布式应用。在服务端,可以通过Spring的org.springframework.remoting.rmi.RmiServiceExporter可以暴露你的服务;在客户端,通过org.springframework.remoting.rmi.RmiPr..
分类:
编程语言 时间:
2015-07-09 14:55:51
阅读次数:
170
publicclassServer{
Sockets=null;
publicServer(){
try{
ServerSocketss=newServerSocket(9999);
s=ss.accept();
}catch(Excetione){
e.printStackTace();
}
}
publicvoidread(){
BufferdReadbr=newBufferdRead(newInputStreamRead(s.getInputStream));
while(true){
Stringst..
分类:
编程语言 时间:
2015-07-09 14:46:59
阅读次数:
106
题目:
Given an array S of n integers, are there elements a, b, c in S such that a + b + c =
0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in a tripl...
分类:
编程语言 时间:
2015-07-09 14:42:02
阅读次数:
129
import Foundation
//1、字符
//用 Character 定义单个字符:
let money: Character = "¥"
var face: Character = "...
分类:
编程语言 时间:
2015-07-09 14:41:23
阅读次数:
151
package com.aa.promotion.dao.generalize;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOExcep...
分类:
编程语言 时间:
2015-07-09 14:42:51
阅读次数:
737
题目:
Implement the following operations of a stack using queues.
push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Re...
分类:
编程语言 时间:
2015-07-09 14:41:27
阅读次数:
135
适配器模式(Adapter Pattern)是作为两个不兼容的接口之间的桥梁。这种类型的设计模式属于结构型模式,它结合了两个独立接口的功能。
意图:将一个类的接口转换成客户希望的另外一个接口。适配器模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作。
主要解决:主要解决在软件系统中,常常要将一些"现存的对象"放到新的环境中,而新环境要求的接口是现对象不能满足的。
何时使用: 1...
分类:
编程语言 时间:
2015-07-09 14:40:59
阅读次数:
177
题目:
Implement the following operations of a queue using stacks.
push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front eleme...
分类:
编程语言 时间:
2015-07-09 14:40:55
阅读次数:
117
题目:
Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume
that each input would h...
分类:
编程语言 时间:
2015-07-09 14:40:16
阅读次数:
111
1. 特点 在python 解析html这篇文章中已经做了初步的介绍,接下来再坐进一步的说明。python抓取页面信息有以下两个特点:
依赖于HTML的架构。
微小的变化可能会导致抓取失败,这取决于你编码的技巧。
2. 抓取示例 首先看一下百度视频网页的源代码,大致浏览下,选定要抓取的网页元素。
假设我们要对div标签id为focusCarouselList里的相关...
分类:
编程语言 时间:
2015-07-09 14:39:44
阅读次数:
145
使用 quit(), exit(), 或者Ctrl-D退出命令行
[root@CentOS-43 workspace]# python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "cr...
分类:
编程语言 时间:
2015-07-09 14:34:25
阅读次数:
103
C++ Primer(第五版)学习笔记_4_标准模板库string(1)
1、创建string对象
创建一个空字符串,其长度为0
#include
#include
using namespace std;
int main(int argc, char* argv[])
{
string s;
cout << s.length() << endl;
re...
分类:
编程语言 时间:
2015-07-09 14:33:32
阅读次数:
122