10 2014 档案

摘要:本章主要介绍了线程,了解如何使用多线程在单进程环境中来执行多任务。由于多个线程共享其进程空间,所以必须采用同步的机制来保护数据的一致性。一.线程的概念 典型的Unix系统都可以看成只有一个控制线程,一个进程在同一时刻只能做一件事。但有了多线程,我们可以设计成在同一时刻进程能做不止一件事,每个... 阅读全文
posted @ 2014-10-24 11:49 晓风_7 阅读(254) 评论(0) 推荐(0)
摘要:本章主要介绍了c++类中成员变量、函数对象的在内存中布局. 当c++类中不包含virtual机制类的函数时,内部nostatic member被包含在每一个class object之中,就想c struct一样,而member function虽然含在class声明之内,却不出现在object之中... 阅读全文
posted @ 2014-10-23 16:46 晓风_7 阅读(243) 评论(0) 推荐(0)
摘要:题目:You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concaten... 阅读全文
posted @ 2014-10-21 22:49 晓风_7 阅读(166) 评论(0) 推荐(0)
摘要:大多数UNIX应用程序都使用I/O库,本章说明了该库所包含的所有函数,以及某些实现细节和效率方面的考虑。同时需要重点关注标准I/O使用了缓冲的技术,但同时也是因为它的出现,产生了很多细节上的问题.流和FILE对象 unix系统调用的函数都是针对文件描述符操作的.而标准I/O库,它们的操作则是围... 阅读全文
posted @ 2014-10-19 17:22 晓风_7 阅读(251) 评论(0) 推荐(0)
摘要:题目:Divide two integers without using multiplication, division and mod operator.思路分析二分法.将除数不断增倍,而结果同样扩大两倍,直到除数的值大于被除数.然后再利用被除数减去除数最后增长到小于被除数的值,递归求出结果.例... 阅读全文
posted @ 2014-10-19 00:27 晓风_7 阅读(204) 评论(0) 推荐(0)
摘要:题目:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space fo... 阅读全文
posted @ 2014-10-10 17:30 晓风_7 阅读(109) 评论(0) 推荐(0)
摘要:Reverse Nodes in k-GroupGiven a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a... 阅读全文
posted @ 2014-10-09 22:16 晓风_7 阅读(152) 评论(0) 推荐(0)
摘要:bind函数在c++11之前,要绑定某个函数、函数对象或者成员函数的不同参数值需要用到不同的转换器,如bind1st、bind2nd、fun_ptr、mem_fun和mem_fun_ref等.在c++11中,绑定参数的方法得以简化.c++11提供了"一站式"绑定模板bind,其用法为:#includ... 阅读全文
posted @ 2014-10-09 16:56 晓风_7 阅读(15362) 评论(0) 推荐(1)
摘要:迭代器迭代器源于指针而高于指针,并成为分割容器与算法的一条界河.在一个共同的迭代器界面约定之下,不同的算法与不同的容器只要其迭代器要求一致就可以相互组合.迭代器分类c++标准库中对迭代器进行了详细的分类,迭代器按其所能提供的操作,可以分为五种类型,分别为: 输入迭代器(input iterator... 阅读全文
posted @ 2014-10-08 20:11 晓风_7 阅读(905) 评论(0) 推荐(0)
摘要:题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your al... 阅读全文
posted @ 2014-10-08 17:04 晓风_7 阅读(143) 评论(0) 推荐(0)
摘要:题目:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"(((... 阅读全文
posted @ 2014-10-06 17:05 晓风_7 阅读(137) 评论(0) 推荐(0)
摘要:题目:Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telep... 阅读全文
posted @ 2014-10-05 11:46 晓风_7 阅读(144) 评论(0) 推荐(0)
摘要:题目:Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Ele... 阅读全文
posted @ 2014-10-02 22:43 晓风_7 阅读(149) 评论(0) 推荐(0)
摘要:最近一直在研究c++模板编程,虽然有些困难,但希望能够坚持下去.今天,在书上看见一个讨论模板编程typename与class两个关键字的区别,觉得挺有意义的,就把它们给总结一下. 先看一个例子:templatetypename C::value_type sum(C &c){ ... 阅读全文
posted @ 2014-10-02 20:16 晓风_7 阅读(394) 评论(0) 推荐(0)