
Algorithm & Data Structure
文章平均质量分 75
丰清云淡
I know I'm ignorant,so I have to pursue the eternal wisdom !
展开
-
Java程序员到架构师的推荐阅读书籍
源链接:http://zhaoyongpan.blog.51cto.com/2714930/659532作为Java程序员来说,最痛苦的事情莫过于可以选择的范围太广,可以读的书太多,往往容易无所适从。我想就我自己读过的技术书籍中挑选出来一些,按照学习的先后顺序,推荐给大家,特别是那些想不断提高自己技术水平的Java程序员们。一、Java编程入门类对于没有Java编程原创 2012-01-17 15:26:39 · 2768 阅读 · 1 评论 -
自己写的智能指针(auto_ptr)
大家都知道,C++使用new运算符分配的内存空间需要由程序员自己释放,而在编写代码过程中难免会有所遗漏。如果能使堆空间内存在离开作用域后自动释放就可以减轻大量的工作,做法就是将指针封装成对象,而这就是智能指针的作用,下面简要实现了对指针的封装://auto_ptr.h:declaration of auto_ptrtemplate class auto_ptr{publ原创 2012-01-17 10:32:32 · 1839 阅读 · 1 评论 -
用C++实现Stack堆栈
记得当初学习数据结构,所有的数据结构均是C语言实现,除了数组最简单的数据结构非堆栈(通常所说的堆栈指栈,其实栈和堆还是有些区别)莫属,现在用C++封装Stack类,模拟栈操作。1.首先是头文件的声明,文件名为"Stack.h",代码如下:#ifndef STACK_H#define STACK_Htemplate class Stack{priv原创 2012-01-05 18:56:56 · 10353 阅读 · 1 评论 -
Find zero pairs
Question :Design and implement an algorithm (C++ function) that, given an array of integers, determines whether the sum of any two distinct elements is zero. Assume, of course, that there might be p原创 2013-01-30 11:20:03 · 1675 阅读 · 2 评论 -
Find the missing numbers
Question:Design and implement an algorithm (C++ function) that, given an array of integers 0 to 2n-1 with two values missing, determines (and displays) the two missing integers. For example, if n is原创 2013-01-30 09:47:08 · 1655 阅读 · 1 评论 -
求5 ~ 1000000000内的回文素数
Question:The number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same number when read forward as backward). Write a program that finds all prime palindr原创 2013-02-02 17:11:59 · 9403 阅读 · 1 评论 -
算法总结:判断一个数是否为素数
1.约定x%y为x取模y,即x除以y所得的余数,当x象都为整数。x^y表示x的y次方。乘方运算的优先级高于乘除和取模,加减的优先级最低。见到x^y/z这样,就先算乘方,再算除法。A/B,称为A除以B,也称为B除A。若A%B=0,即称为A可以被B整除,也称B可以整除A。A*B表示A乘以B或称A乘B,B乘A,B乘以A……都一样。复习一下小学数学公因数:两个不同的自然原创 2013-02-02 12:22:05 · 79732 阅读 · 6 评论