2019年3月15日

c++ 面试题(算法类)

摘要: 1,从无序的数据流中找到其中位数:(用大根堆和小根堆来实现) 1 float getMidimum(vector<int>& nums) { 2 priority_queue<int> bigHeap; // 大数优先 3 priority_queue<int, vector<int>, great 阅读全文

posted @ 2019-03-15 16:54 爱笑的张飞 阅读(481) 评论(0) 推荐(0)

2019年3月13日

c++ 面试题(汇总)

摘要: 1,extern 关键字作用: http://www.cnblogs.com/lzjsky/archive/2010/11/24/1886686.html 2,static 关键字作用: https://baike.sogou.com/v3239767.htm?fromTitle=static ht 阅读全文

posted @ 2019-03-13 13:21 爱笑的张飞 阅读(520) 评论(0) 推荐(0)

2019年3月6日

leetcode 树类型题

摘要: 树的测试框架: 1 // leetcodeTree.cpp : 定义控制台应用程序的入口点。 2 // 3 4 #include "stdafx.h" 5 #include <iostream> 6 #include <queue> 7 #include <stack> 8 #include <ve 阅读全文

posted @ 2019-03-06 21:29 爱笑的张飞 阅读(245) 评论(0) 推荐(0)

error LNK2019: 无法解析的外部符号 "class std::basic_ostream<char,struct std::char_traits<char> >

摘要: 1,VS2013: 错误 1 error LNK2019: 无法解析的外部符号 "class std::basic_ostream<char,struct std::char_traits<char> > & __cdecl operator<<(class std::basic_ostream<c 阅读全文

posted @ 2019-03-06 18:19 爱笑的张飞 阅读(9222) 评论(0) 推荐(2)

VS2013 error C2556: “const int &Array<int>::operator [](int)”: 重载函数与“int &Array<int>::operator [](int)”只是在返回类型上不同

摘要: 1,VS2013 错误 1 error C2556: “const int &Array<int>::operator [](int)”: 重载函数与“int &Array<int>::operator [](int)”只是在返回类型上不同 出错代码: 出错原因: 在 C++ 中,两个只有返回类型不 阅读全文

posted @ 2019-03-06 18:03 爱笑的张飞 阅读(798) 评论(0) 推荐(0)

c++中的类(class)-----笔记(类模板)

摘要: 1,一个类模板至少具有一个类参数,类参数是个符号以表示将要被某个确定数据类型代替的类型。 1 #include<iostream> 2 #include<string> 3 4 using namespace std; 5 6 template <class T> 7 class Array { 8 阅读全文

posted @ 2019-03-06 17:19 爱笑的张飞 阅读(1428) 评论(0) 推荐(0)

2019年3月4日

c++中的类(class)-----笔记(类多态)

摘要: 1,多态是一种运行期绑定机制,通过这种机制,实现将函数名绑定到函数具体实现代码的目的。一个函数的名称与其入口地址是紧密相连的,入口地址是该函数在内存中的起始地址。如果对一个函数的绑定发生在运行时刻而非编译时刻,我们就称该函数是多态的。 2,C++多态的三个前提条件:(a)必须存在一个继承体系结构;( 阅读全文

posted @ 2019-03-04 20:28 爱笑的张飞 阅读(2611) 评论(0) 推荐(0)

2019年3月2日

c++中的类(class)-----笔记(类继承)

摘要: 1,派生类继承了基类的所有成员函数和数据成员(构造函数、析构函数和操作符重载函数外)。 2,当不指明继承方式时,默认为私有继承。 3,基类的私有成员仅在基类中可见,在派生类中是不可见的。基类的私有成员可以由派生类继承,但在派生类中不可见。尽管在派生类中不能直接访问基类的私有成员,但可以通过间接的方式 阅读全文

posted @ 2019-03-02 20:42 爱笑的张飞 阅读(2111) 评论(0) 推荐(0)

leetcode 栈和队列类型题

摘要: 1,Valid Parentheses 1 bool isVaild1(string& s) { // 直接列举,不易扩展 2 stack<char> stk; 3 for (int i = 0; i < s.length(); ++i) { 4 if (stk.empty()) 5 stk.pus 阅读全文

posted @ 2019-03-02 17:36 爱笑的张飞 阅读(285) 评论(0) 推荐(0)

2019年3月1日

leetcode 字符串类型题

摘要: 1,Vaild Palindrome 1 bool isPalindrome(string& s) { 2 transform(s.begin(), s.end(), s.begin(), tolower); // 把字符全部转换成小写 3 int left = 0; 4 int right = s 阅读全文

posted @ 2019-03-01 16:55 爱笑的张飞 阅读(396) 评论(0) 推荐(0)

导航