自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

A_Bo的博客

不怕别人比你聪明,就怕别人比你聪明还比你努力

原创 C++原始指针模拟实现reverse函数

写在前面 今天笔试中有一个题目,要求将单词翻转,例如"hx hell1 liwe! asfd",根据空格来划分单词,如果单词中存在非字母,则原样输出,否则翻转输出(不能使用函数库函数) 程序 #include <iostream> #incl...

2019-03-04 21:11:15 428 0

原创 1119 Pre- and Post-order Traversals (30 分)

目录 1119Pre- and Post-order Traversals 题目描述 解题思路 程序 1119Pre- and Post-order Traversals 题目描述 Suppose that all the keys in a binary tree are dist...

2019-03-01 16:37:02 593 1

原创 AVL_tree_1123 Is It a Complete AVL Tree (30 分)

目录 1123Is It a Complete AVL Tree 题目描述 解题思路 程序 1123Is It a Complete AVL Tree 题目描述 An AVL tree is a self-balancing binary search tree. In an AVL...

2019-03-01 13:03:30 126 0

原创 Eulerian_1126 Eulerian Path (25 分)

目录 1126Eulerian Path 题目描述 解题思路 程序 vector中resize和reserve函数的区别 参考博客 1126Eulerian Path 题目描述 In graph theory, an Eulerian path is a path in a gr...

2019-03-01 10:17:49 170 0

原创 LCA_1143 Lowest Common Ancestor (30 分)

目录 1143 Lowest Common Ancestor  解题思路 程序 参考博客 1143 Lowest Common Ancestor The lowest common ancestor (LCA) of two nodes U and V in a tree is the...

2019-02-27 15:58:06 135 0

原创 Sort_1141 PAT Ranking of Institutions (25 分)

目录 1141 PAT Ranking of Institutions 题目描述 解题思路 程序 1141 PAT Ranking of Institutions 题目描述 After each PAT, the PAT Center will announce the rankin...

2019-02-27 15:18:41 81 0

原创 模拟_1150 Travelling Salesman Problem

目录 1150 Travelling Salesman Problem 题目描述 解题思路 程序 1150 Travelling Salesman Problem 题目描述 The "travelling salesman problem" asks the fo...

2019-02-27 11:11:46 122 0

原创 dfs_1155 Heap Paths (30 分)

目录 1155 Heap Paths 题目描述 解题思路 程序 1155 Heap Paths 题目描述 In computer science, a heap is a specialized tree-based data structure that satisfies the...

2019-02-26 21:13:30 84 0

原创 dfs_1106 Lowest Price in Supply Chain (25 分)

目录 1106 Lowest Price in Supply Chain 题目描述 解题思路 程序 1106 Lowest Price in Supply Chain 题目描述 A supply chain is a network of retailers(零售商), distri...

2019-02-26 16:45:06 134 0

原创 dfs_1103 Integer Factorization (30 分)

目录 1103 Integer Factorization 题目描述 解题思路 程序 1103 Integer Factorization 题目描述 The K−P factorization of a positive integer N is to write N as the ...

2019-02-26 16:06:22 68 0

原创 模拟_1105 Spiral Matrix (25 分)

目录 1105 Spiral Matrix 题目描述 解题思路 程序  1105 Spiral Matrix 题目描述 This time your job is to fill a sequence of N positive integers into a spiral matr...

2019-02-26 13:17:35 218 0

原创 二叉树_1099 Build A Binary Search Tree (30 分)

目录 1099 Build A Binary Search Tree 题目描述 解题思路 程序 参考博客 1099 Build A Binary Search Tree 题目描述 A Binary Search Tree (BST) is recursively defined a...

2019-02-25 19:41:38 130 0

原创 STL_1095 Cars on Campus (30 分)

1095 Cars on Campus 题目描述 Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate number...

2019-02-25 17:58:56 253 0

原创 Heap Sort_1098 Insertion or Heap Sort (25 分)

目录 题目描述 解题思路 插入排序 堆排序(大顶堆排序) 程序 参考博客 题目描述 According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and ...

2019-02-25 15:36:45 65 0

原创 BFS_1091 Acute Stroke (30 分)

目录 题目描述 Input Specification: Output Specification: Sample Input: Sample Output: 解题思路 程序 题目描述 One important factor to identify acute stroke (...

2019-02-25 11:24:53 73 0

原创 unordered_set,unordered_map中自定义hashfunction

写在前面 在c++11新标准中引入了unordered_set以及unordered_map,其背后是根据hash实现,而set、map等背后是根据RB_tree实现,在实现hash时,需要将数据转换为对应的hash码,放入对应的bucket中,所以这里的hash function是至关重要的 ...

2019-02-22 11:50:05 1228 0

原创 c++ Variadic Templates(可变参数列表)

写在前面 在c++11中新引入了Variadic Templates(可变参数列表),和initialize_list不同的是,Variadic Templates可以支持不同类型的参数,而initialize_list只支持同一种类型的参数,并且在vector、max等容器或者函数中内部已经实...

2019-02-17 21:59:43 204 0

原创 C++中的new_handler、set_new_handler、get_new_handler函数

写在前面 在operator new或者operator new[]内存分配失败时,会不止一次调用由client指定的handler(当然handler也有默认形式),可以有源码中发现 void* operator new(size_t size,const std::nothrow_t&a...

2019-02-14 11:40:41 249 0

原创 C++中自定义简单内存配置器

目录 写在前面 参考程序 第一版本 第二版本 第三版本 参考文献 写在前面 通过C++中内存分配的几种方式我们知道,如果我们要使用自己定义的内存配置器,需要我们重载operator new、operator delete、operator new[]、operator delete...

2019-02-14 09:46:33 229 0

原创 list_1097 Deduplication on a Linked List (25 分)

1097 Deduplication on a Linked List (25 分) Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated abso...

2019-02-09 22:53:56 99 0

原创 C++中内存分配的几种方式

目录 写在前面 函数解释 malloc/free函数 new/delete函数 array new/delete函数 ::operator new/delete函数 new整体流程 delete整体流程 operator new/delete的重载 写在前面 C++中内存分配...

2019-02-09 15:50:12 759 0

原创 c++11 左值右值

目录 写在前面  栗子 左值右值 std::move:强制转化为右值 参考文献 写在前面 在c++2.0之前存在着Big Three,分别是析构函数、拷贝构造函数、拷贝赋值函数 A(const A&); A &operator(const A&am...

2019-02-09 09:34:47 120 0

原创 完全二叉树_1110 Complete Binary Tree

目录 题目描述 思路 程序 参考博客 题目描述 1110 Complete Binary Tree (25 分) Given a tree, you are supposed to tell if it is a complete binary tree. Input Specif...

2019-02-05 21:29:16 90 0

原创 sort_1109 Group Photo

1109 Group Photo (25 分) Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following: ...

2019-02-04 11:41:47 54 0

原创 sort_1137 Final Grading

1137 Final Grading (25 分) For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), ...

2019-02-02 18:13:14 90 0

原创 queue_1133 Splitting A Linked List

1133 Splitting A Linked List (25 分) Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear be...

2019-02-02 12:41:05 54 0

原创 BFS_1094 The Largest Generation

1094 The Largest Generation (25 分) A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the sa...

2019-02-01 20:46:22 79 0

原创 思路_1093 Count PAT's (25 分)

1093 Count PAT's (25 分) The string APPAPT contains two PAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th chara...

2019-02-01 18:16:36 109 0

原创 拓扑排序_1146 Topological Order

1146 Topological Order (25 分) This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtai...

2019-02-01 16:32:15 84 0

原创 暴力_1144 The Missing Number

1144 The Missing Number (20 分) Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specif...

2019-02-01 14:35:53 47 0

原创 并查集_1118 Birds in Forest

1118 Birds in Forest (25 分) Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture be...

2019-01-30 14:20:19 163 0

原创 素数判定_1116 Come on! Let's C

1116 Come on! Let's C (20 分) "Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Te...

2019-01-29 22:34:27 51 0

原创 模拟_1122 Hamiltonian Cycle (25 分)

1122 Hamiltonian Cycle (25 分) The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle i...

2019-01-29 18:20:44 105 0

原创 模拟_1121 Damn Single (25 分)

1121 Damn Single (25 分) "Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who ar...

2019-01-29 15:49:02 85 0

原创 BFS_1090 Highest Price in Supply Chain (25 分)

1090 Highest Price in Supply Chain (25 分) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved i...

2019-01-29 10:40:32 137 0

原创 c++11初始化列表(initializer_list)

目录 写在前面 详述 initializer_list部分源码 方法 使用 参考文献   写在前面 c++11标准中,initializer_list对于标准库的编写影响非常大,说一个简单的例子,在c++11之前,max函数的源程序是这样的: template &lt...

2019-01-18 18:38:22 1470 0

原创 模拟_1080 Graduate Admission (30 分)

1080 Graduate Admission (30 分) It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang P...

2019-01-12 22:29:48 158 0

原创 BFS_1076 Forwards on Weibo (30 分)

1076 Forwards on Weibo (30 分) Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other...

2019-01-11 17:13:15 66 0

原创 数据结构_1074 Reversing Linked List (25 分)

1074 Reversing Linked List (25 分) Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For...

2019-01-11 15:04:19 112 0

原创 c++11多线程中的std::async异步函数

目录 写在前面 解析 future类成员函数 wait_for以及wait_until返回值类型 get函数 valid函数 wait_for函数 std::launch类型 参考博客 写在前面 如果有一个需要长时间运算的线程,需要计算出最终的有效值,但是现在不迫切需要这个数...

2019-01-10 22:12:26 2024 0

提示
确定要删除当前文章?
取消 删除