Module 2 Flashcards

Memorization

1
Q

It is a process in which a function calls itself directly or
indirectly.

A

Recursion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

It is a process which breaks a task into smaller subtasks.

A

Recursion
(smaller subtask)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

It is a powerful technique that can be used in place of
iterations.

A

Recursion
(powerful technique)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

True or False. A base case should be defined to avoid infinite loops.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The ________ is when a loop repeatedly executes until the controlling condition becomes false.

A

Iteration
(loop repeatedly executes)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

True or False. Recursion and Iteration both repeatedly execute the set of instructions.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

True or False. Recursion is applied to the set of instructions which we want to get repeatedly executed.

A

False
(ITERATION is applied to the set of instructions which we want to get repeatedly executed)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or False. Recursion is a process, always applied to a function.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Iteration uses _______ structure.

A

Repetition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

True or False. An infinite loop occurs with iteration if the loop condition test never becomes true and Infinite looping uses CPU cycles repeatedly.

A

False
(An infinite loop occurs with iteration if the loop condition test never becomes FALSE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or False. An iteration does not use the stack so it’s faster than recursion.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or False. An iteration terminates when the loop condition is satisfied.

A

False
( An iteration terminates when the loop condition FAILS)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Recursion uses ______ structure.

A

Selection

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

True or False. Iteration consumes less memory but makes the code longer.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

True or False. Recursion terminates when a base case is recognized.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

True or False. Infinite recursion occurs if the recursion step does not reduce the problem in a manner that converges on some condition (base case) and Infinite recursion can crash the system.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

True or False. Recursion is usually faster than iteration despite the overhead of maintaining the stack.

A

False
(Recursion is usually SLOWER than iteration DUE TO the overhead of maintaining the stack)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

True or False. Recursion uses less memory than iteration.

A

False
(Recursion uses MORE memory than iteration)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

True or False. Recursion makes the code smaller.

17
Q

What are the 4 types of recursion?

A

(DINT)
- Direct Recursion
- Indirect Recursion
- Tail Recursion
- Non-Tail Recursion

18
Q

This type of recursion calls the same function again.

A

Direct Recursion

19
Q

This type of recursion calls another function which then calls the same function again.

A

Indirect Recursion

20
Q

This type of recursion has a recursive call as the last thing done by the function.

A

Tail Recursion
(recursive call is the last thing done)

21
Q

This type of recursion’s recursive call is not the last thing done by the recursion.

A

Non-Tail Recursion
(recursive call is not the las thing done)

22
True or False. The efficiency of an algorithm can only be in terms of time.
False (can be in terms of TIME AND SPACE)
23
There is a systematic approach that has to be applied for analyzing any given algorithm. This systematic approach is modelled by a framework called as _____________.
Analysis Framework
24
The _________ of an algorithm can be decided by measuring the performance of an algorithm.
Efficiency
25
Analysis of algorithm is the process of investigation of an algorithm’s efficiency respect to two resources. What are these two resources?
- Running Time - Memory Space
26
The reason for selecting the two criteria of analysis of algorithm are?
(SGSM) - Simplicity - Generality - Speed - Memory
27
_________________ indicates how fast an algorithm runs.
Time efficiency or /time complexity
28
_________________ is the amount of memory units required by the algorithm including the memory needed for the i/p & o/p.
Space Efficiency or Space complexity
28
In mathematics, computer science, and related fields, _______________ describes the limiting behavior of a function when the argument tends towards a particular value or infinity, usually in terms of simpler functions.
Big O Notation (describes the limiting behavior of a function)
29
True or False. When time complexity is expressed using big O notation, the time complexity is said to be described asymptotically, i.e., as the input size goes to infinity.
True
30
The _________ of an algorithm quantifies the amount of time taken by an algorithm to run as a function of the size of the input to the problem.
Time Complexity (amount of time taken)
31
True or False. Analysis of algorithms and data structure is the major force that drives the design of solutions.
True
32
What are the scientific methods in the framework for predicting performance and comparing algorithms?
(OHPVV) - OBSERVE the natural world - HYPOTHESIZE a model that is consistent with observations - PREDICT events using hypothesis - VERIFY the predictions by making further observations - VALIDATE by repeating until the hypothesis and observations agree
33
What are the principles in the framework for predicting performance and comparing algorithms?
- Experiments must be REPRODUCIBLE - Hypothesis must be FALSIFIABLE
34
It refers to the amount of memory required by an algorithm (including the input values to the algorithm) to run.
Space complexity
35
It is the extra space or the temporary space used by the algorithm during it's execution.
Auxiliary Space
36
While executing, what are the three reasons that algorithms use memory space?
(DIE) - Data Space - Instruction Space - Environmental Stack
37
It is the amount of memory used to save the compiled version of instructions.
Instruction Space
38
It is the amount of space used by the variables and constants.
Data Space
39
It is a count denoting number of times of execution of a statement.
Frequency Count
40
41
42