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.

A

True

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
Q

True or False. The efficiency of an algorithm can only be in terms of time.

A

False
(can be in terms of TIME AND SPACE)

23
Q

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 _____________.

A

Analysis Framework

24
Q

The _________ of an algorithm can be decided by
measuring the performance of an algorithm.

A

Efficiency

25
Q

Analysis of algorithm is the process of investigation
of an algorithm’s efficiency respect to two resources. What are these two resources?

A
  • Running Time
  • Memory Space
26
Q

The reason for selecting the two criteria of analysis of algorithm are?

A

(SGSM)
- Simplicity
- Generality
- Speed
- Memory

27
Q

_________________ indicates
how fast an algorithm runs.

A

Time efficiency or /time complexity

28
Q

_________________ is the amount of memory units required by the
algorithm including the memory needed for the i/p & o/p.

A

Space Efficiency or Space complexity

28
Q

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.

A

Big O Notation
(describes the limiting behavior of a function)

29
Q

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.

A

True

30
Q

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.

A

Time Complexity
(amount of time taken)

31
Q

True or False. Analysis of algorithms and data structure is the major force that drives the design of solutions.

A

True

32
Q

What are the scientific methods in the framework for predicting performance and comparing algorithms?

A

(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
Q

What are the principles in the framework for predicting performance and comparing algorithms?

A
  • Experiments must be REPRODUCIBLE
  • Hypothesis must be FALSIFIABLE
34
Q

It refers to the amount of memory required by an algorithm
(including the input values to the algorithm) to run.

A

Space complexity

35
Q

It is the extra space or the temporary space used by the algorithm during it’s execution.

A

Auxiliary Space

36
Q

While executing, what are the three reasons that algorithms use memory space?

A

(DIE)
- Data Space
- Instruction Space
- Environmental Stack

37
Q

It is the amount of memory used to save the compiled version of instructions.

A

Instruction Space

38
Q

It is the amount of space used by the variables and constants.

A

Data Space

39
Q

It is a count denoting number of
times of execution of a statement.

A

Frequency Count

40
Q
A
41
Q
A
42
Q
A