摘要:179. Largest Number Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9],
阅读全文
随笔分类 - C++
摘要:179. Largest Number Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9],
阅读全文
摘要:定义栈的数据结构,要求添加一个 min 函数,能够得到栈的最小元素。 要求函数 min、push 以及 pop 的时间复杂度都是 O(1)。 >test.exeStack is not initialized.stack push 9stack push 5stack push 6stack pus
阅读全文
摘要:## 1. 把二元查找树转变成排序的双向链表 ## ### 题目: 输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。 ### 要求不能创建任何新的结点,只调整指针的指向。 10 / \ 6 14 / \ / \ 4 8 12 16 转换成双向链表 4=6=8=10=12=14=16。 首
阅读全文
摘要:网上关于WTL的文章,尤其是中文的文章不多,根据收集的资料整理出了VS2013安装WTL的方法。 1、下载。文件很小的,地址:http://sourceforge.net/projects/wtl/files/latest/download 2、解压安装包。找到“VS安装目录\VC\VCWizard
阅读全文
摘要:从root开始遍历,如果n1和n2中的任一个和root匹配,那么root就是LCA。 如果都不匹配,则分别递归左、右子树,如果有一个 key(n1或n2)出现在左子树,并且另一个key(n1或n2)出现在右子树,则root就是LCA. 如果两个key都出现在左子树,则说明LCA在左子树中,否则在右子...
阅读全文
摘要:解决二叉树的很多问题的方案都是基于对二叉树的遍历。遍历二叉树的前序,中序,后序三大方法算是计算机科班学生必写代码了。其递归遍历是人人都能信手拈来,可是在手生时写出非递归遍历恐非易事。正因为并非易事,所以网上出现无数的介绍二叉树非递归遍历方法的文章。可是大家需要的真是那些非递归遍历代码和讲述吗?代码早...
阅读全文
摘要:#include "List.h"#include #include using namespace std;#define max(a, b) (a) > (b) ? (a) : (b)// LeetCode, Longest Substring Without Repeating Charact...
阅读全文
摘要:#ifndef List_h__#define List_h__#include struct ListNode{ int value; ListNode* pNext; ListNode(int n) :value(n), pNext(nullptr){}};class List...
阅读全文
摘要:Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu...
阅读全文
摘要:先看下面代码:#include #include #include class Test{public: Test(int i) :a(i) { } ~Test() { }public: void Print() { pri...
阅读全文
摘要:More info see: https://msdn.microsoft.com/en-us/library/hh916383.aspxSimply stated, SAL is an inexpensive way to let the compiler check your code for ...
阅读全文
摘要:If you'd like to build the Chromium Embedded Framework (a wrapper for Chromium, for creating browser-based applications) using Visual Studio 2013, you...
阅读全文
摘要:C++中调用Python脚本的意义就不讲了,至少你可以把它当成文本形式的动态链接库, 需要的时候还可以改一改,只要不改变接口, C++的程序一旦编译好了,再改就没那么方便了 先看Python的代码 代码:#test function def add(a,b): print "in python ...
阅读全文
摘要:http://m.blog.csdn.net/blog/haoekin/88512191.无法显示右边箭头的问题无论怎么折腾都没显示不出来,微软给的示例又能显示,度娘和谷歌也都不知道,经过不断地探索总算找到解决办法了:在rc2文件中加上下面的内容即可#ifndef _AFXDLL#include "...
阅读全文
摘要:#include "stdafx.h"void PrintFunc(int a[], int n){ for (int i = 0; i low; --j) { if (a[j]AlgoTest.exe0 8 7 6 5 4 3 2 1 90 1 7 6 5...
阅读全文
摘要:#include "stdafx.h"void PrintFunc(int a[], int n){ for (int i = 0; i =0&& a[j]>x)//重点 { a[j + 1] = a[j]; j...
阅读全文
摘要:打开调试开关:
阅读全文
摘要:http://www.zhangjiee.com/新浪微博@独酌逸醉.Github.GitCafe.stackoverflow.Quorahttp://cpp1x.org/刘未鹏 | MIND HACKShttp://www.drdobbs.com/cpp/其它转自别人:http://blog.cs...
阅读全文
摘要:void CAttendanceRobotDlg::DocumentCompleteExplorer4(LPDISPATCH pDisp, VARIANT* URL){ // TODO: Add your message handler code here HRESULT hr; ...
阅读全文
摘要:网是开源的c/c++日志库也不少,但用起来总觉得不方便,于是动手写了一个C++日志框架Log4K。测试代码:#include "log4k.h"#pragma comment(lib, "log4k.lib")static int g_Cnt = 0;void LogTestThread1(LPVO...
阅读全文
|