摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single 阅读全文
posted @ 2015-08-02 18:09 A.ArmStrong 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two n 阅读全文
posted @ 2015-08-02 17:04 A.ArmStrong 阅读(190) 评论(0) 推荐(0) 编辑
摘要: C++中map容器提供一个键值对容器,map与multimap差别仅仅在于multiple允许一个键对应多个值。一、map的说明1头文件#include2定义mapmy_Map;或者是typedefmapMY_MAP;MY_MAPmy_Map;3插入数据(1)my_Map["a"]=1;(2)my_... 阅读全文
posted @ 2015-08-02 16:21 A.ArmStrong 阅读(201) 评论(0) 推荐(0) 编辑
摘要: Brute-Force算法Brute-Force算法简称BF算法:也称简单匹配算法,其基本思路是:从目标串s=”s0s1…sn-1”的第一个字符开始和模式串t=”t0t1…tm-1”中的第一个字符比较,若相等,则继续逐个比较后续字符,否则,从目标串s的第2个字符开始重新与模式串t的第一个字符进行比较... 阅读全文
posted @ 2015-08-02 15:57 A.ArmStrong 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 哈希表是种数据结构,它可以提供快速的插入操作和查找操作。第一次接触哈希表时,它的优点多得让人难以置信。不论哈希表中有多少数据,插入和删除(有时包括侧除)只需要接近常量的时间即0(1)的时间级。实际上,这只需要几条机器指令。对哈希表的使用者一一人来说,这是一瞬间的事。哈希表运算得非常快,在计算机程序中... 阅读全文
posted @ 2015-08-02 10:35 A.ArmStrong 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 在c++中,vector是一个十分有用的容器,下面对这个容器做一下总结。1 基本操作(1)头文件#include.(2)创建vector对象,vector vec;(3)尾部插入数字:vec.push_back(a);(4)使用下标访问元素,cout::iterator it;for(it=vec.... 阅读全文
posted @ 2015-08-02 10:18 A.ArmStrong 阅读(117) 评论(0) 推荐(0) 编辑