上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要: adjacent_findSearches for two adjacent elements that are either equal or satisfy a specified condition.即,找出第一组满足条件的相邻元素。template<class ForwardIterator> ForwardIterator adjacent_find( ForwardIterator _First, ForwardIterator _Last );template<class ForwardIterator , class BinaryPredicate... 阅读全文
posted @ 2013-03-07 16:19 freewater 阅读(177) 评论(0) 推荐(0) 编辑
摘要: make_heapConverts elements from a specified range into a heap in which the first element is the largest and for which a sorting criterion may be specified with a binary predicate.template<class RandomAccessIterator> void make_heap( RandomAccessIterator _First, RandomAccessIterator _Last... 阅读全文
posted @ 2013-03-07 15:34 freewater 阅读(428) 评论(0) 推荐(0) 编辑
摘要: 本节的四个算法所接受的set,必须是有序区间(sorted range),元素值可以重复出现。也就是说,他们可以接受STL的set/multiset容器作为输入区间。set_unionUnites all of the elements that belong to at least one of two sorted source ranges into a single, sorted destination range, where the ordering criterion may be specified by a binary predicate.template<clas 阅读全文
posted @ 2013-03-07 15:26 freewater 阅读(618) 评论(0) 推荐(0) 编辑
摘要: 二分查找binary_searchTests whether there is an element in a sorted range that is equal to a specified value or that is equivalent to it in a sense specified by a binary predicate.template<class ForwardIterator, class Type> bool binary_search( ForwardIterator _First, ForwardIterator _Last, ... 阅读全文
posted @ 2013-03-07 15:15 freewater 阅读(501) 评论(0) 推荐(0) 编辑
摘要: copyAssigns the values of elements from a source range to a destination range, iterating through the source sequence of elements and assigning them new positions in a forward direction.template<class InputIterator, class OutputIterator> OutputIterator copy( InputIterator _First, InputIt... 阅读全文
posted @ 2013-03-07 14:48 freewater 阅读(614) 评论(0) 推荐(0) 编辑
摘要: mismatchCompares two ranges element by element either for equality or equivalent in a sense specified by a binary predicate and locates the first position where a difference occurs.template<class InputIterator1, class InputIterator2> pair<InputIterator1, InputIterator2> mismatch( InputIt 阅读全文
posted @ 2013-03-07 13:15 freewater 阅读(267) 评论(0) 推荐(0) 编辑
摘要: maxCompares two objects and returns the larger of the two, where the ordering criterion may be specified by a binary predicate.template<class Type> const Type& max( const Type& _Left, const Type& _Right );template<class Type, class Pr> const Type& max( const Type& _Le 阅读全文
posted @ 2013-03-07 12:34 freewater 阅读(3377) 评论(0) 推荐(0) 编辑
摘要: lexicographical_compareCompares element by element between two sequences to determine which is lesser of the two.(以字典排列方式进行比较)template<class InputIterator1, class InputIterator2> bool lexicographical_compare( InputIterator1 _First1, InputIterator1 _Last1, InputIterator2 _First2, ... 阅读全文
posted @ 2013-03-07 11:07 freewater 阅读(269) 评论(0) 推荐(0) 编辑
摘要: iter_swapExchanges two values referred to by a pair of specified iterators.template<class ForwardIterator1, class ForwardIterator2> void iter_swap( ForwardIterator1 _Left, ForwardIterator2 _Right );这个好像没有什么特别的,就是交换两个迭代器所指向的内容。swapThe first override exchanges the values of two objects. ... 阅读全文
posted @ 2013-03-07 10:59 freewater 阅读(616) 评论(0) 推荐(0) 编辑
摘要: fillAssigns the same new value to every element in a specified range.template<class ForwardIterator, class Type> void fill( ForwardIterator _First, ForwardIterator _Last, const Type& _Val );fill_nAssigns a new value to a specified number of elements in a range beginning with a p... 阅读全文
posted @ 2013-03-07 10:55 freewater 阅读(659) 评论(0) 推荐(0) 编辑
摘要: equalCompares two ranges element by element either for equality or equivalence in a sense specified by a binary predicate.template<class InputIterator1, class InputIterator2> bool equal( InputIterator1 _First1, InputIterator1 _Last1, InputIterator2 _First2 );template<class Input... 阅读全文
posted @ 2013-03-06 19:42 freewater 阅读(328) 评论(0) 推荐(0) 编辑
摘要: <numeric>:Defines container template functions that perform algorithms provided for numerical processing.accumulateComputes the sum of all the elements in a specified range including some initial value by computing successive partial sums or computes the result of successive partial results si 阅读全文
posted @ 2013-03-06 19:26 freewater 阅读(1251) 评论(0) 推荐(0) 编辑
摘要: 1.递归实现int binarySearchRecursive(int a[],int low,int high,int key){ if(low>high) return -(low+1); int mid=low+(high-low)/2; if(key<a[mid]) return binarySearchRecursive(a,low,mid-1,key); else if(key > a[mid]) return binarySearchRecursive(a,mid+1,high,key); else ... 阅读全文
posted @ 2013-03-01 17:40 freewater 阅读(14016) 评论(1) 推荐(0) 编辑
摘要: getline is to read a line of characters from input stream.My naive implement as follows, 1 #include<stdio.h> 2 3 /* getline: get line into s, return length. 4 arguments: lim is the max length of s. 5 */ 6 int getline(char s[],int lim) 7 { 8 int c;//store character acquired from input stream. 9 阅读全文
posted @ 2013-02-05 12:16 freewater 阅读(604) 评论(0) 推荐(0) 编辑
摘要: 简洁的atoi 1 #include<ctype.h> //isspace and isdigit 2 3 /* convert string to integer */ 4 int atoi(char s[]) 5 { 6 int i,n,sign; 7 for(i=0;isspace(s[i]);i++)//skip white space 8 ; 9 sign=(s[i]=='-')?-1:1;10 if(s[i]=='+'||s[i]=='-')//skip sign11 i++;12 for(n=0;isdig... 阅读全文
posted @ 2013-02-05 10:51 freewater 阅读(187) 评论(0) 推荐(0) 编辑
摘要: itoa是广泛应用的非标准C语言扩展函数。由于它不是标准C语言函数,所以不能在所有的编译器中使用。但是,大多数的编译器(如Windows上的)通常在<stdlib.h>头文件中包含这个函数。在<stdlib.h>中与之有相反功能的函数是atoi。功能:把一整数转换为字符串。那么如何实现一个itoa函数呢?这个好像难度一般,我就直接附上我的实现,对此不熟悉的人最好自己code一下。atoi version one 1 /* reverse the string named s */ 2 void reverse(char s[]) 3 { 4 for(int i=0,j= 阅读全文
posted @ 2013-02-04 19:40 freewater 阅读(473) 评论(0) 推荐(0) 编辑
摘要: 查看索引名称、列名及特性。select index_name, column_name, index_type,uniquenessfrom user_indexes natural join user_ind_columnswhere table_name='TEST';查看约束select table_name, constraint_name,constraint_type,statusfrom user_constraintswhere table_name not like 'BIN%'order by 1;待续。。。 阅读全文
posted @ 2012-12-23 18:32 freewater 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 转自:http://os.51cto.com/art/201211/364849.htm【编者按】对于淘宝网而言,2012年的“双十一”是一个交易里程碑,是一个购物狂欢日,在这个“神棍节”里,淘宝创下191亿元的交易额,在交易的背后隐藏着哪些复杂技术?你发现快要过年了,于是想给你的女朋友买一件毛衣,你打开了www.taobao.com。这时你的浏览器首先查询DNS服务器,将www.taobao.com转换成ip地址。不过首先你会发现,你在不同的地区或者不同的网络(电信、联通、移动)的情况下,转换后的IP地址很可能是 不一样的,这首先涉及到负载均衡的第一步,通过DNS解析域名时将你的访问分配到不 阅读全文
posted @ 2012-11-20 10:26 freewater 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 创建大量的测试数据,动不动就需要上万条,如何通过一条SQL快速生成大量的测试数据的方法。SQL> select rownum as id, 2 to_char(sysdate + rownum / 24 / 3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime, 3 trunc(dbms_random.value(0, 100)) as random_id, 4 dbms_random.string('x', 20) random_string 5 ... 阅读全文
posted @ 2012-10-16 14:58 freewater 阅读(4479) 评论(0) 推荐(0) 编辑
摘要: 有陷阱,要考虑溢出问题int comp_int(int var1, int var2)/* return value < 0: means var1 < var2; * = 0: means var1 = var2; * > 0: means var1 > var2;*/{ int bit_width, msb, rtnvar; bit_width = sizeof(int) << 3; msb = var2 >> (bit_width -1) - var1 >> (bit_width -1);... 阅读全文
posted @ 2012-10-10 09:47 freewater 阅读(573) 评论(2) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 10 下一页