Lauen_1

Stay foolish

2016年11月6日

2-6 Working with Lambdas

摘要: 在C++中使用匿名函数,格式如下:[] () {}; Using a Lambda to Print array Values 1 #include <algorithm> 2 #include <array> 3 #include <cstdint> 4 #include <iostream> 5 阅读全文

posted @ 2016-11-06 16:56 Lauen_1 阅读(119) 评论(0) 推荐(0) 编辑

2-5. Working with Compile Time Constants

摘要: C++有时候为了运行效率,提供了很多的feature,虽然比较难用 关键字constexpr 就是在编译时进行推导,提升运行效率。 Using constexpr to Define the Size of an array Creating constexpr class Constructors 阅读全文

posted @ 2016-11-06 16:18 Lauen_1 阅读(174) 评论(0) 推荐(0) 编辑

2-4. Using auto with Functions

摘要: 在C++14中允许使用type deduction用于函数参数和函数返回值 Return Type Deduction in C++11 Deducing return types for C++11 template functions In order to reduce the verbose 阅读全文

posted @ 2016-11-06 15:49 Lauen_1 阅读(188) 评论(0) 推荐(0) 编辑

2-3. Using Type Deduction

摘要: Type Deduction 发生在编译时期 可以对一般类型,自定义类型进行类型自推导 下面有两个例子: 1. Using auto with a class 2.Using auto with Uniform Initialization use auto for local variables 阅读全文

posted @ 2016-11-06 15:16 Lauen_1 阅读(302) 评论(0) 推荐(0) 编辑

2-2. Initializing Objects with Initializer Lists

摘要: Using Uniform Initialization to Construct a vector 1.使用Uniform Initialization可以使得初始化比较方便。 2.using的使用也比较陌生 阅读全文

posted @ 2016-11-06 14:59 Lauen_1 阅读(142) 评论(0) 推荐(0) 编辑

Modern C++ CHAPTER 2(读书笔记)

摘要: CHAPTER 2 Recipe 2-1. Initializing Variables Recipe 2-2. Initializing Objects with Initializer Lists 使用初始化列表的使用 Recipe 2-3. Using Type Deduction 关于aut 阅读全文

posted @ 2016-11-06 14:36 Lauen_1 阅读(204) 评论(0) 推荐(0) 编辑

2015年10月26日

图的基本算法

摘要: 总结图的基本存储结构,表示方式及基本算法。包括邻接表、DFS、BFS、Prim、Kruskal、Bellman-Ford和Dijkstra等。邻接表非稠密图的标准表示称作为邻接表,将每个顶点的所有相邻顶点均保存在该顶点对应的元素所指向的一张链表中。DFS这种搜索所遵循的策略是尽可能深地搜索图,在对于... 阅读全文

posted @ 2015-10-26 16:57 Lauen_1 阅读(246) 评论(0) 推荐(0) 编辑

2015年10月25日

关于查找

摘要: 介绍二分查找,二叉查找树(结合链表和二分查找的特性),平衡二叉查找树(AVL树,2-3树,红黑树),B树等。二分查找二分查找是针对有序数组的,但是二分查找的插入比较慢,在插入比较多的情况并不适用。二叉查找树结合二分查找与链表的特点,设计出了二叉查找树,如下图所示在二叉查找树中,左子树的关键字不大... 阅读全文

posted @ 2015-10-25 20:47 Lauen_1 阅读(245) 评论(0) 推荐(0) 编辑

2015年10月16日

C++ STL 助记1:vector

摘要: vector intVector(10, 100); // Creates vector of 10 ints with value 100vector stringVector(10, "hello");vector intVector3({ 1, 2, 3, 4, 5, 6 });vector ... 阅读全文

posted @ 2015-10-16 22:39 Lauen_1 阅读(169) 评论(0) 推荐(0) 编辑

2015年7月28日

摘要: C语言的堆区与栈区 数据结构中的最大二叉堆: 如图所示,它是一颗完全的二叉树,除了最后一层外都是填满的,堆的子女和父母的关系可以利用上标计算。 关于最大二叉堆的操作,有保持堆性质MAX-HEAPIFY,建立堆BUILD-MAX-HEAP过程。若需要使用二叉堆进行堆排序,则需要HEAP-EXTRA-MAX等。 堆保持的递归算法如下: 通过比较元素与左右子女的大小,判断有没有保持堆的要... 阅读全文

posted @ 2015-07-28 21:10 Lauen_1 阅读(200) 评论(0) 推荐(0) 编辑

导航