原创 圖文並茂詳解KMP算法

原貼地址:http://www.cnblogs.com/yjiyjige/p/3263858.html KMP算法應該是每一本《數據結構》書都會講的,算是知名度最高的算法之一了,但很可惜,我大二那年壓根就沒看懂過~~~ 之後也在

原创 通過異或^交換指針所指數據出現的問題

void swapChar(char*p1,char*p2){     char a=*p1;char b=*p2;     (*p1)^=(*p2);     (*p2)^=(*p1);     (*p1)^=(*p2);     co

原创 Functionality of void operator()()函數形式

class A { public: A(); ~A(); A(int, int); void operator()(int a,int b) { cout <<"called by operator()(int a,i

原创 返回類型是函數指針的函數指針 類比複雜的數組聲明

先看看複雜聲明的數組: int  *ptrs[10];//ptrs是含有10個int指針的數組 int &refs[10]=/*?*/; //錯誤,不存在引用的數組 int (*par)[10]=&arr;//par指向一個含有10個整數

原创 N個降序數組,找到最大的K個數TOP K

轉載至:http://www.cnblogs.com/ywl925/p/3794852.html 假定有20個有序數組,每個數組有500個數字,降序排列,數字類型32位uint數值,現在需要取出這10000個數字中最大的500個,怎麼

原创 C/C++中volatile關鍵字詳解

原文出處:http://www.cnblogs.com/yc_sunniwell/archive/2010/07/14/1777432.html  1. 爲什麼用volatile?     C/C++ 中的 volatile 關鍵字和 c

原创 LeetCode中一些鏈表方面的題

記錄一下鏈表的一些題目 #include "stdafx.h" #include<iostream> #include"MyChain.h" #include <stack> using namespace std; //一個Y形鏈表

原创 多線程和socket編程的一些問題

1. #include<errno.h> #include<string.h>才能使使用strerror(int)不報未聲明的錯誤 2.join()函數的用法 thread t1([](){ th

原创 Introduction to A*

原文地址: http://www.redblobgames.com/pathfinding/a-star/introduction.html Created 26 May 2014, updated Aug 2014, Feb 2016

原创 C++'s most vexing parse

原文::http://zkt.name/c-s-most-vexing-parse/ https://en.wikipedia.org/wiki/Most_vexing_parse C++'s most vexing parse 最

原创 windows 10 + vs2015+ opencv3.0.0 +附加模塊opencv_contrib編譯和配置

原文出處:http://blog.csdn.net/chentravelling/article/details/59540828 0.前言 將基於低版本OpenCV(比如2.3.1)的程序,在vs2015+opencv3.0的環境

原创 CvMat,Mat和IplImage之間的轉化和拷貝

1、CvMat之間的複製 //注意:深拷貝 - 單獨分配空間,兩者相互獨立 CvMat* a; CvMat* b = cvCloneMat(a); //copy a to b 2、Mat之間的複製 //注意

原创 將數字轉爲二、十、十六進制字符串

MSDN的例子 Example 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

原创 cin.()和cin.getline()

cin.ignore(x, y)中的參數看成兩個條件, x條件表示忽略x個,y條件就表示忽略y和y之前的字符,y條件優先級高於x。 int main(){ char str1[30], str2[30], str3[30];

原创 深入理解pthread_cond_wait、pthread_cond_signal

出處:http://blog.csdn.net/yeyuangen/article/details/37593533 ===============================man pthread_cond_wait的解釋====