自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(104)
  • 资源 (4)
  • 收藏
  • 关注

转载 2021-08-03

这里写自定义目录标题共享变量的并发读写共享变量的并发读写转载自:http://oceanbase.org.cn/?p=82[LockFree之美] 共享变量的并发读写4条回复共享对象的并发读写在高性能并发服务器中,对于共享对象的读写是最常见的操作之一,比如全局配置类对象的并发读取和更新,以及更复杂的如copy on write btree、堆栈等的并发读写,最基本的操作都可以简化理解为通过全局共享的指针,并发读取和更新指针所指向对象的操作。最简单的模型如下所示,一个包含了多个字段的结构体:s

2021-08-03 22:45:12 122

转载 mmap相关

mmap和常规文件操作的区别对linux文件系统不了解的朋友,请参阅我之前写的博文《从内核文件系统看文件读写过程》,我们首先简单的回顾一下常规文件系统操作(调用read/fread等类函数)中,函数的调用过程:1、进程发起读文件请求。2、内核通过查找进程文件符表,定位到内核已打开文件集上的文件信息,从而找到此文件的inode。3、inode在address_space上查找要请求的文件页是...

2020-04-14 11:18:55 119

原创 华为机试刷题

服务器广播题目:服务器连接方式包括直接相连,间接连接。 A 和 B 直接连接, B 和 c 直接连接,则 A 和 c 间接连接。直接连接和间接连接都可以发送广播。给出一个 N * N 数组,代表 N 个服务器, matrix[i][j] == 1 ,则代表 i 和 j 直接连接;不等于 1 时,代表 i 和 j 不直接连接。 matrix[i][i]== 1 ,即自己和自己直接连接。 matr...

2020-03-19 21:40:00 8970

原创 linux 之 screen 的使用方法

远程连接服务器时,如果连接中断,则跑的代码,传输的数据就废了。幸运的是,screen 这款工具能很好的解决这个问题。重新连上服务器后,在 screen 中执行的任务可以接着执行。下面就介绍一些主要、使用的用法。

2017-04-01 10:02:37 602

原创 跨服务器的复制操作

跨服务器的复制操作有两个命令,一个是 scp(security copy),一个是 rcp(remote file copy),区别是 scp 是加密的更安全,rcp 不是加密的。下面是scp的用法:假如现在有服务器A,IP地址为 ipa,用户名为 usera,有服务器B,IP地址为 ipb,用户名为 userb目前位于A的终端,把服务器A的/data目录拷贝到服务器B的/des目录下: scp

2017-03-22 20:19:14 783

原创 迅雷笔试之-纸牌游戏有牛无牛

今日迅雷笔试题一:给定5张牌(除大小王),J/Q/K代表10,A代表1,其他数字还是对应数字。5张牌中有三张加起来是10的倍数就叫有牛,任意三张加起来都不等于10就叫无牛。有牛的情况下,剩余两张加起来的和的个位数为牛数,比如4+7则牛数为1。输入要求:五张牌以逗号分隔输入;输出要求:无牛和输入错误的情况输出“none”,有牛的情况下输出牛数。#include<iostream>#include<m

2016-09-20 09:55:26 548

原创 路灯最小发光距离

题目描述 V先生有一天工作到很晚,回家的时候要穿过一条长l的笔直的街道,这条街道上有n个路灯。假设这条街起点为0,终点为l,第i个路灯坐标为ai。路灯发光能力以正数d来衡量,其中d表示路灯能够照亮的街道上的点与路灯的最远距离,所有路灯发光能力相同。为了让V先生看清回家的路,路灯必须照亮整条街道,又为了节省电力希望找到最小的d是多少?输入 输入两行数据,第一行是两个整数:路灯数目n (1≤n≤10

2016-09-17 16:26:25 686

原创 二进制中1的个数

面试官的手机被他调皮的儿子小明用一个数字作为密码锁上了。 小明只记得这个数字的十进制范围是l~r,且这个数的二进制表示中恰有m个1,却不记得确切的数字了。 面试官可急坏了。这才有了小赛一个将功赎过的机会。 他想要让小赛算出,他最坏情况下,要试多少次密码才能确保打开手机呢? 请输出这个次数。 输出 : 输出一行,包含一个整数,表示面试官最坏情况下,要试多少次密码才能确保打开手机。 如果小

2016-09-16 21:12:47 376

原创 第n天股票价格

经过严密的计算,小赛买了一支股票,他知道从他买股票的那天开始,股票会有以下变化:第一天不变,以后涨一天,跌一天,涨两天,跌一天,涨三天,跌一天…依此类推。 为方便计算,假设每次涨和跌皆为1,股票初始单价也为1,请计算买股票的第n天每股股票值多少钱?#include<iostream>using namespace std;int main(){ int n; while (ci

2016-09-16 19:59:40 2016

原创 删除字符串末尾所有空格

删除字符串末尾的所有空格。注意使用 char[ ] 是数组,用栈存储,可以修改其中元素。而 char* ,string 是字符串常量,在静态存储区,不可修改。另外 strlen 是函数,只能处理 char* 数据,返回的的元素个数不包含结束符 NULL(‘\0’).#include<iostream>using namespace std;char* rtrim(char* str){

2016-09-16 15:49:31 3880

原创 腾讯-找出两个数组中少掉的一个元素

16年腾讯秋招软开第一道编程题(去掉了繁琐的输入要求)。题目大意是给定两个数组,第一个有 n 个元素,第二个有 n-1 个元素,两个数组区别除了少一个元素其他一样。找出少掉的这个元素。主要是注意 find 函数和vector 的 erase 函数。#include<iostream>#include<vector>using namespace std;int main(){ int

2016-09-08 09:03:34 764

原创 Leetcode 7. Reverse Integer

Example1: x = 123, return 321 Example2: x = -123, return -321class Solution {public: int reverse(int x) { string s=to_string(x); for(int i=0,j=s.size()-1;i<j;++i,--j){

2016-09-02 12:33:04 192

原创 Leetcode 371. Sum of Two Integers

Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example: Given a = 1 and b = 2, return 3.用二进制的异或、与运算代替加减class Solution {public: int getSum(int a, in

2016-09-02 12:10:34 207

原创 Leetcode 389. Find the Difference

Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was added in

2016-09-02 11:24:55 201

原创 Leetcode 1. Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums = [2, 7, 11, 1

2016-09-01 12:52:24 225

原创 Leetcode 58. Length of Last Word

Given a string s consists of upper/lower-case alphabets and empty space characters ’ ‘, return the length of last word in the string.If the last word does not exist, return 0.Note: A word is defined as

2016-09-01 11:39:10 214

原创 Leetcode 19. Remove Nth Node From End of List

Given a linked list, remove the nth node from the end of list and return its head.For example,Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, the linked list be

2016-09-01 10:57:29 206

原创 Leetcode 257. Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are: [“1->2->5”, “1->3”]用深度优先搜索+递归处理/** * Definition f

2016-09-01 10:21:04 206

原创 Leetcode 234. Palindrome Linked List

Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) space? 题目是求单链表是否是回文。根据在平台上测试结果知:12->34->12是回文,而不是说 12->343 ->21是回文,这个概念要搞清楚。解题思路很简单,用两个节

2016-09-01 00:20:57 263

原创 Leetcode 238. Product of Array Except Self

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n).For e

2016-08-02 15:40:57 207

原创 Leetcode 378. Kth Smallest Element in a Sorted Matrix

Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix.Note that it is the kth smallest element in the sorted order, not the

2016-08-02 14:58:48 321

原创 字符串查找、排序

将第一行中含有第二行中“23”的数输出并排序输入第一行数字:123 423 5645 875 186523在输入第二行中:23将将一行中含有第二行中“23”的数字输出并排序结果即:123 423 186523#include<iostream>#include<string>#include<vector>#include<sstream>#include<algorithm>using

2016-07-12 11:38:27 404

原创 Leetcode 230. Kth Smallest Element in a BST

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST’s total elements.Follow up: What if the BST is mod

2016-06-29 22:05:42 250

原创 Leetcode 365. Water and Jug Problem

You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to determine whether it is possible to measure exactly z litres using these two ju

2016-06-27 16:27:53 596

原创 Leetcode 328. Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.You should try to do it in plac

2016-06-17 22:15:30 220

原创 Leetcode 62. Unique Paths

A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the botto

2016-06-17 21:11:38 204

原创 Leetcode 67. Add Binary

Given two binary strings, return their sum (also a binary string).For example, a = “11” b = “1” Return “100”.按照二进制的加法规则进行编程就行了class Solution {public: string addBinary(string a, string b) {

2016-06-17 15:04:39 259

原创 Leetcode 213. House Robber II

Note: This is an extension of House Robber.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

2016-06-17 11:23:18 184

原创 Leetcode 337. House Robber III

The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the “root.” Besides the root, each house has one and only one parent house. After a tour,

2016-06-17 10:28:59 224

原创 Leetcode 319. Bulb Switcher

There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or turning off i

2016-06-16 22:41:06 197

原创 Leetcode 219. Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between i and j is at most k.最开始写了下面这个错误

2016-06-16 21:59:18 299

原创 Leetcode 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, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number of unique ele

2016-06-15 20:51:40 321

原创 Leetcode 268. Missing Number

Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, 3] return 2.Note: Your algorithm should run in line

2016-06-15 17:02:12 185

原创 Leetcode 318. Maximum Product of Word Length

Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assume that each word will contain only lower case lette

2016-06-15 16:51:44 214

原创 Leetcode 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 example, given n = 2, return 1

2016-06-15 16:07:06 181

原创 Leetcode 260. Single Number III

Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given nums = [1,

2016-06-14 11:36:55 242

原创 Leetcode 28. Implement strStr()

Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.这道题目主要有这三种方法。在Leetcode上并没有展现KMP和BM算法的优势,应该与OJ的测试样例有关; 暴力解法时间复杂度 O(MN), KMP 为

2016-06-13 18:13:39 271

转载 字符串匹配的Boyer-Moore算法

转载自:http://www.ruanyifeng.com/blog/2013/05/boyer-moore_string_search_algorithm.html上一篇文章,我介绍了KMP算法。 但是,它并不是效率最高的算法,实际采用并不多。各种文本编辑器的”查找”功能(Ctrl+F),大多采用Boyer-Moore算法。Boyer-Moore算法不仅效率高,而且构思巧妙,容易理解。1977年

2016-06-12 23:54:52 277

转载 字符串匹配的KMP算法

本篇关于KMP算法的讲解是我搜集到的认为讲的最简单易懂的一篇,分享给大家一起学习。转载自:http://www.ruanyifeng.com/blog/2013/05/boyer-moore_string_search_algorithm.html 字符串匹配是计算机的基本任务之一。 举例来说,有一个字符串”BBC ABCDAB ABCDABCDABDE”,我想知道,里面是否包含另一个字符串”ABC

2016-06-12 23:36:50 228

原创 Leetcode 165. Compare Version Numbers

Compare two version numbers version1 and version2. If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.You may assume that the version strings are non-empty and conta

2016-06-11 17:07:14 173

CNN模型简单介绍(LeNet,AlexNet,VGG,GoogLeNet,ResNet,GAN,R-CNN)

CNN模型简单介绍,按照提出时间依次介绍LeNet,AlexNet,VGG,GoogLeNet,ResNet,GAN,R-CNN。十几页的ppt,主要介绍各个模型的核心思想、贡献,希望能为大家提供一条清晰的CNN发展脉络。具体的算法实现等需要阅读文章代码。相关文章会作为另一个资源提供免费打包下载。

2017-01-16

CNN模型简单介绍(LeNet,AlexNet,VGG,GoogLeNet,ResNet,GAN,R-CNN)

CNN模型简单介绍,按照提出时间依次介绍LeNet,AlexNet,VGG,GoogLeNet,ResNet,GAN,R-CNN。十几页的ppt,主要介绍各个模型的核心思想、贡献,希望能为大家提供一条清晰的CNN发展脉络。具体的算法实现等需要阅读文章代码。相关文章会作为另一个资源提供免费打包下载。

2017-01-16

针对窄带和多信道系统的CMOS射频发射器芯片CC1070及其应用

cc1070对于学习射频电路初级阶段的学友是款不错的学习芯片

2012-12-23

空空如也

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

TA关注的人

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