adding fact animation
This commit is contained in:
@@ -160,6 +160,8 @@ int fact(int n) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Play this [animation](https://jidongxiao.github.io/CSCI1200-DataStructures/animations/recursion/factorial/index.html) to see how this fact() function works.
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
int intpow(int n, int p) {
|
int intpow(int n, int p) {
|
||||||
if (p == 0) {
|
if (p == 0) {
|
||||||
@@ -269,6 +271,6 @@ The Fibonacci sequence is defined:
|
|||||||
Fibonacci sequence.
|
Fibonacci sequence.
|
||||||
2. Write an iterative version of Fibonacci that uses a vector to improve the running time of the function.
|
2. Write an iterative version of Fibonacci that uses a vector to improve the running time of the function.
|
||||||
3. What is the order notation of the running time for each version?
|
3. What is the order notation of the running time for each version?
|
||||||
- Play this [animation](https://jidongxiao.github.io/CSCI1200-DataStructures/animations/dynamic_memory/example1/index.html), which illustrates the time complexity of the recursvie version.
|
- Play this [animation](https://jidongxiao.github.io/CSCI1200-DataStructures/animations/recursion/fibonacci/index.html), which illustrates the time complexity of the recursvie version.
|
||||||
|
|
||||||
4. What is the order notation of the memory usage for each version?
|
4. What is the order notation of the memory usage for each version?
|
||||||
|
|||||||
Reference in New Issue
Block a user