- 博客(5)
- 收藏
- 关注
原创 查找数组里面第k大元素
int kthLargestElement1(int k, vector &nums) { // write your code here int L = 0; int R = nums.size() - 1; int low = L; int high = R; while (L { low = L;
2018-02-06 16:24:13 424
原创 快速排序
void quicksort(int *arr, int left, int right) { int key = arr[left]; int low = left; int high = right; if (low >= high) { return; } while (low {
2018-01-04 10:38:54 97
原创 二叉树按层打印
// testcode.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include #include using namespace std; typedef struct sBTree { sBTree* left; sBTree* right; int data; }BTree; int _t
2018-01-02 11:39:57 250
转载 C++中的虚函数(表)实现机制以及用C语言对其进行的模拟实现
C++中的虚函数(表)实现机制以及用C语言对其进行的模拟实现 目录 [显示] 前言 大家都应该知道C++的精髓是虚函数吧? 虚函数带来的好处就是: 可以定义一个基类的指针, 其指向一个继承类, 当通过基类的指针去调用函数时, 可以在运行时决定该调用基类的函数还是继承类的函数. 虚函数是实现多态(动态绑定)/接口函数的基础. 可以说: 没有虚函数, C++将变
2017-12-08 16:27:54 200
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人