自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(111)
  • 资源 (1)
  • 收藏
  • 关注

转载 传输层TCP和UDP的区别分析与应用场景

基本概念: 1: 面向报文面向报文的传输方式是应用层交给UDP多长的报文,UDP就照样发送,即一次发送一个报文。因此,应用程序必须选择合适大小的报文。若报文太长,则IP层需要分片,降低效率。若太短,会是IP太小。UDP对应用层交下来的报文,既不合并,也不拆分,而是保留这些报文的边界。这也就是说,应用层交给UDP多长的报文,UDP就照样发送,即一次发送一个报文。 2: 面向字节流面向字节流的话,虽

2017-10-15 16:32:43 457

原创 TCP

TCP的滑动窗口、流量控制、拥塞控制和连接管理 套接字 socket = (IP地址:端口号)ARQ自动重传请求 重传的请求是自动进行的。接收方不需要请求发送方重传某个出差分组

2017-09-17 21:42:42 957

原创 数据共享,内存映射文件和虚拟内存,共享内存

一、内存映射 内存映射文件允许开发人员预定一块地址空间区域并给区域调拨物理存储器。内存映射文件的物理存储器来自磁盘已有的文件,而不是来自系统的页交换文件。一旦把文件映射到地址空间,就可以对它进行访问,就好像整个文件都已经被载入内存一样。不必再对文件执行I/O操作。 使用内存映射文件来颠倒文件内容时,先打开文件并向系统预订一块虚拟地址空间区域。接着让系统把文件的第一个字节映射到该区域的第

2017-09-17 16:28:28 4780

原创 C++ 设计模式-单例-工厂

设计模式的六大原则 (1)几种设计原则的小结(6个原则的首字母组合单词(S.O.L.I.D,表示稳定) ①单一职责原则告诉我们实现类要职责单一; ②里氏替换原则告诉我们不要破坏继承体系;所有使用基类的地方必须能透明地使用子类替换,而程序的行为没有任何变化 ③依赖倒置原则告诉我们要面向接口编程; ④接口隔离原则告诉我们在设计

2017-09-12 15:08:57 698

原创 2018京东笔试 疯狂序列 神奇数

疯狂序列 输入:169 输出:18#include <iostream>#include <math.h>using namespace std;int main(){ long long n; long long m, a, b, res; while (scanf("%lld", &n) != EOF) { m = sqrt((doubl

2017-09-09 21:30:30 675

原创 148. Sort List (归并) 和147. Insertion Sort List

148. Sort List Sort a linked list in O(n log n) time using constant space complexity.题意 对一个链表进行排序,要求时间复杂度O(nlogn),一般就是快排、归并、堆排序。这里选择归并排序思路 分为两个步骤,一个步骤是拆分,直至都是单个结点,拆分使用了三个指针pre、slow、fast。slow走一步

2017-09-05 17:29:36 215

原创 2018届美团笔试 k的倍数 改考卷。搜狗圆周上点的距离。

题一 k的倍数思路 k的倍数且求的是最长连续子序列。 更改523. Continuous Subarray Sum思路2即可 每次计算得到的余数,若不在hash表中,就插入到hash表中,若余数已经在hash表中,当前位置的索引减去之前的位置,即可得到这个子区间的长度。 class Solution { public: int checkSubarr

2017-09-04 15:51:56 628

原创 LeetCode 523. Continuous Subarray sum和 525. Contiguous Array和560. Subarray Sum Equals K

523. Continuous Subarray Sum Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to the multi

2017-09-03 21:58:06 571

原创 操作系统知识点

死锁的四个必要条件和怎么处理一. 什么是死锁? 如果一个进程集合里面的每个进程都在等待这个集合中的其他一个进程(包括自身)才能继续往下执行,若无外力他们将无法推进,这种情况就是死锁,处于死锁状态的进程称为死锁进程二. 死锁产生的原因? 1.因竞争资源发生死锁 现象:系统中供多个进程共享的资源的数目不足以满足全部进程的需要时,就会引起对诸资源的竞争而发生死锁现象 (1)可

2017-08-29 20:57:06 376

原创 二叉堆,堆排序,STL优先队列的底层实现,剑指offer数据流中的中位数

一.下图是从数组为0下标开始计算的。 下图是从数组为1下标开始计算的。引自《STL源码剖析》 p173

2017-08-14 11:06:21 612

原创 深信服面试记录 2017

深信服面试记录 电话面了接近40分钟,对于自己简历上写的东西一定要清清楚楚明明白白,切勿模棱两可!!!1.线程的通信方式。A线程拥有互斥变量,B线程需要这个互斥变量,当A线程意外退出,B线程能否获取这个互斥变量?2.MFC中创建线程的流程、管理方式、使用那些API3.局部线程存储4.项目中使用内存映射解释,虚拟内存的原理,使用方式。直接读取磁盘和内存映射的区别。虚拟内存是否涉及IO操作。5.socket并发

2017-07-26 16:16:50 1396 1

原创 2018 好未来面试 C++ 知识点随笔

不定时更新。遇到好的问题记录 [toc]好未来一面 智能指针实现机制,弱指针和智能指针 c++11的特性有哪些 lamda和函数对象的区别 继承的理解 virtual继承和普通继承 virtual函数和普通函数的区别 覆盖和重载 QQ窗口设计 函数对象,函数,函数指针,之间的关系 两个栈实现一个队列 如何查找一个链表的中位数

2017-07-24 20:50:55 1072

原创 排序算法

一.各种算法的对比二.各个算法的详解1.冒泡算法//冒泡排序void bubbleSort(int arr[], int n){ for (int i = 0; i < n;i++) { for (int j = 0; j < n-i-1;j++) { if (arr[j]>arr[j+1]) { swap(arr[j], arr[j +

2017-07-16 21:31:45 459

原创 Effective C++ 知识点记录

导读声明式,定义式,初始化explict关键字,类的构造函数声明为explict,可以阻止它们被用来执行隐式类型转换。 除非有一个好理由允许构造函数被用于隐式类型转换,否则声明为explictpass-by-value意味着“调用拷贝构造函数“,以值传递

2017-07-07 17:02:58 601

原创 LeetCode 213. House Robber II 注意考察环尾和环头交叉处

213. House Robber II After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this plac

2017-06-20 21:38:21 326

原创 LeetCode 198. House Robber 递归->记忆->动态规划 ->新思路

198. House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is

2017-06-20 21:21:55 664

原创 LeetCode 343. Integer Break 动态规划,状态转移方程

343. Integer Break Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get. For exa

2017-06-19 15:51:36 520

转载 C++类内存分布 通过Visual studio 2013查看

C++类内存分布转载自:http://www.cnblogs.com/jerry19880126/p/3616999.html书上类继承相关章节到这里就结束了,这里不妨说下C++内存分布结构,我们来看看编译器是怎么处理类成员内存分布的,特别是在继承、虚函数存在的情况下。工欲善其事,必先利其器,我们先用好Visual Studio工具,像下面这样一步一步来: 

2017-06-17 10:25:44 896 6

原创 LeetCode 64. Minimum Path Sum 动态规划

64. Minimum Path Sum Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. Note: You can only move

2017-06-16 16:03:58 493

原创 LeetCode 120. Triangle 动态规划

120. Triangle Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the following triangle [

2017-06-15 23:03:49 930

原创 LeetCode 70. Climbing Stairs 自顶向下记忆化搜索,自底向上重叠子问题动态规划

70. Climbing Stairs You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Not

2017-06-15 19:31:30 594

原创 LeetCode 51. N-Queens 回溯

51. N-Queens The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-q

2017-06-14 21:04:05 314

原创 LeetCood 200. Number of Islands floodfill算法,回溯算法

200. Number of Islands Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or ve

2017-06-13 22:31:15 478

原创 LeetCode 79. Word Search 二维平面使用回溯法

79. Word Search Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizon

2017-06-13 20:44:37 1090

原创 LeetCode 77. Combinations 组合问题C(n,k),树形状态回溯,优化减枝

77. Combinations Given two integers n and k, return all possible combinations of k numbers out of 1 … n. For example, If n = 4 and k = 2, a solution is: [ [2,4], [3,4], [2

2017-06-06 21:08:42 748

原创 LeetCode 46. Permutations 全排列,树形状态回溯

46. Permutations Given a collection of distinct numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [ [1,2,3], [1,3,2], [2,1,3

2017-06-05 22:20:27 686

原创 LeetCode 131. Palindrome Partitioning 树形问题,状态回溯

131. Palindrome Partitioning Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s

2017-06-05 21:03:01 619

原创 LeetCode 17. Letter Combinations of a Phone Number 递归回溯法

17. Letter Combinations of a Phone Number Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to letters (just like on the telepho

2017-06-05 20:35:02 1347

原创 LeetCode 235. Lowest Common Ancestor of a Binary Search Tree 二叉搜索树

235. Lowest Common Ancestor of a Binary Search Tree Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. According to the definition of LCA on W

2017-06-02 22:11:21 325

原创 LeetCode 437. Path Sum III 递归中使用递归,分两类情况

437. Path Sum III You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need to start or end at the

2017-06-02 22:00:40 538

原创 LeetCode 257. Binary Tree Paths 递归过程保存信息

257. Binary Tree Paths Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3 \ 5 All root-to-leaf paths are:

2017-06-01 21:24:43 368

原创 LeetCode 404. Sum of Left Leaves 递归终止条件

404. Sum of Left Leaves Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two left leaves in the binary tree,

2017-05-31 21:46:57 261

原创 LeetCode 112. Path Sum 注意递归的终止条件

112. Path Sum Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. For example: Given the below b

2017-05-31 21:21:09 465

原创 LeetCode 226. Invert Binary Tree 递归、指针交换 思考链表的交换

226. Invert Binary Tree Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1Trivia: This problem was i

2017-05-31 14:53:15 270

原创 LeetCode 104. Maximum Depth of Binary Tree和111. Minimum Depth of Binary Tree 递归

104. Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.

2017-05-27 19:34:51 447

原创 LeetCode 347. Top K Frequent Elements 优先队列的使用及注意事项

Top K Frequent Elements题意注意思路代码结果优先队列的使用347. Top K Frequent Elements Given a non-empty array of integers, return the k most frequent elements. For example, Given [1,1,1,2,2,3] and k = 2

2017-05-26 17:38:10 666

原创 LeetCode 279. Perfect Squares 转换思维图的无权BFS,寻最短路径

Perfect Squares题意注意思路代码题外memset的使用279. Perfect Squares Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, …) which sum to n. For example:

2017-05-26 17:15:34 799

原创 LeetCode 107. Binary Tree Level Order Traversal II 树的BFS、DFS

Binary Tree Level Order Traversal II题意思路代码BFSDFS107. Binary Tree Level Order Traversal II Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to

2017-05-25 22:28:00 697

原创 LeetCode 102. Binary Tree Level Order Traversal 树的广度优先遍历 辅助数据结构队列

Binary Tree Level Order Traversal题意思路代码结果102. Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level

2017-05-25 22:15:36 627

原创 LeetCode 94. Binary Tree Inorder Traversal 树的前序、中序,后序遍历的非递归实现

题目Binary Tree Inorder TraversalBinary Tree Preorder TraversalBinary Tree Postorder Traversal思路代码题目94. Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes

2017-05-24 20:05:01 298

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

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