上一页 1 2 3 4 5 6 7 8 9 ··· 11 下一页
摘要: 这个问题简单来说就是:要被删除的指针指向的是单个对象呢,还是对象数组?这只有你来告诉delete。如果你在用delete时没用括号,delete就会认为指向的是单个对象,否则,它就会认为指向的是一个数组:string *stringptr1 = new string; string *stringptr2 = new string[100]; ... delete stringptr1; /... 阅读全文
posted @ 2009-04-13 12:28 AlexusLi 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 每一趟从待排序的数据元素中选出最小(或最大)的一个元素,顺序放在已排好序的数列的最后,直到全部待排序的数据元素排完。 选择排序是不稳定的排序方法。 n个记录的文件的直接选择排序可经过n-1趟直接选择排序得到有序结果: ①初始状态:无序区为R[1..n],有序区为空。 ②第1趟排序 在无序区R[1..n]中选出关键字最小的记录R[k],将它与无序区的第1个记录R[1]交换,使R[... 阅读全文
posted @ 2009-04-08 13:41 AlexusLi 阅读(243) 评论(1) 推荐(0) 编辑
摘要: 快速排序的最坏情况基于每次划分对主元的选择。基本的快速排序选取第一个元素作为主元。这样在数组已经有序的情况下,每次划分将得到最坏的结果。一种比较常见的优化方法是随机化算法,即随机选取一个元素作为主元。这种情况下虽然最坏情况仍然是O(n^2),但最坏情况不再依赖于输入数据,而是由于随机函数取值不佳。实际上,随机化快速排序得到理论最坏情况的可能性仅为1/(2^n)。所以随机化快速排序可以对于绝大多数输... 阅读全文
posted @ 2009-04-08 12:20 AlexusLi 阅读(1802) 评论(0) 推荐(0) 编辑
摘要: 交换排序的基本思想是:两两比较待排序记录的关键字,发现两个记录的次序相反时即进行交换,直到没有反序的记录为止。 应用交换排序基本思想的主要排序方法有:冒泡排序和快速排序。 冒泡排序 1、排序方法 将被排序的记录数组R[1..n]垂直排列,每个记录R看作是重量为R.key的气泡。根据轻气泡不能在重气泡之下的原则,从下往上扫描数组R:凡扫描到违反本原则的轻气泡,就使其向上"飘浮... 阅读全文
posted @ 2009-04-08 11:41 AlexusLi 阅读(360) 评论(0) 推荐(0) 编辑
摘要: Unlike stored procedures (which are simply stored SQL statements), triggers are tied to individual tables. A trigger associated with INSERT operations on the Orders table will be executed only when... 阅读全文
posted @ 2009-04-01 16:21 AlexusLi 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Indexes are used to sort data logically to improve the speed of searching and sorting operations. The best way to understand indexes is to envision the index at the back of a book (this book, for ex... 阅读全文
posted @ 2009-04-01 16:20 AlexusLi 阅读(229) 评论(0) 推荐(0) 编辑
摘要: To simplify complex operations (as seen in the previous example) by encapsulating processes into a single easy-to-use unit. To ensure data consistency by not requiring that a ... 阅读全文
posted @ 2009-03-31 15:27 AlexusLi 阅读(191) 评论(1) 推荐(0) 编辑
摘要: You've already seen one use for views. Here are some other common uses: To reuse SQL statements. To simplify complex SQL operations. After the query is written, it can be reu... 阅读全文
posted @ 2009-03-30 15:30 AlexusLi 阅读(214) 评论(3) 推荐(0) 编辑
摘要: Now suppose that you had multiple catalog items created by the same vendor. Where would you store the vendor information (things like vendor name, address, and contact information)? You wouldn't wan... 阅读全文
posted @ 2009-03-27 11:21 AlexusLi 阅读(227) 评论(1) 推荐(0) 编辑
摘要: map的基本用法:如插入、查找、删除、遍历等等,同时告诉你如何实现双键map,包括 (1) 只有两个键都匹配才命中目标 (2) 两个键中任意一个匹配就命中目标 可以扩展到多键 (一) 介绍 特点: 1.map将Key的object和T的Object绑定到一起,因此是一种Pair Associative Container, 表示其value type为 pair。 2.它同时也是Unique A... 阅读全文
posted @ 2009-03-17 12:01 AlexusLi 阅读(1687) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 ··· 11 下一页