mirror of
https://github.com/huihut/interview.git
synced 2024-03-22 13:10:48 +08:00
修改可能的错误
`doSomething`应该是一个函数 `归并查找`改为`归并排序`
This commit is contained in:
parent
8cf04481b7
commit
859be40c57
20
README.md
20
README.md
|
@ -1131,6 +1131,9 @@ catch (bad_cast b) {
|
|||
typeid、type_info 使用
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
class Flyable // 能飞的
|
||||
{
|
||||
public:
|
||||
|
@ -1143,6 +1146,7 @@ public:
|
|||
void foraging() {...} // 觅食
|
||||
virtual void takeoff() {...}
|
||||
virtual void land() {...}
|
||||
virtual ~Bird(){}
|
||||
};
|
||||
class Plane : public Flyable // 飞机
|
||||
{
|
||||
|
@ -1164,7 +1168,7 @@ private:
|
|||
...
|
||||
};
|
||||
|
||||
class doSomething(Flyable *obj) // 做些事情
|
||||
void doSomething(Flyable *obj) // 做些事情
|
||||
{
|
||||
obj->takeoff();
|
||||
|
||||
|
@ -1177,7 +1181,15 @@ class doSomething(Flyable *obj) // 做些事情
|
|||
}
|
||||
|
||||
obj->land();
|
||||
};
|
||||
}
|
||||
|
||||
int main(){
|
||||
Bird *b = new Bird();
|
||||
doSomething(b);
|
||||
delete b;
|
||||
b = nullptr;
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
@ -1472,13 +1484,13 @@ typedef struct {
|
|||
* 问题的分解
|
||||
* 问题规模的分解
|
||||
* 折半查找(递归)
|
||||
* 归并查找(递归)
|
||||
* 归并排序(递归)
|
||||
* 快速排序(递归)
|
||||
|
||||
#### 递归与迭代
|
||||
|
||||
* 迭代:反复利用变量旧值推出新值
|
||||
* 折半查找(迭代)
|
||||
* 折半排序(迭代)
|
||||
* 归并查找(迭代)
|
||||
|
||||
#### 广义表
|
||||
|
|
Loading…
Reference in New Issue
Block a user