01 DS and Algorithm Session 01
01 DS and Algorithm Session 01
01 DS and Algorithm Session 01
Rationale
Answer:
static, dynamic
Answer:
Greedy
Recursion:
Refers to the technique of defining a process in terms of itself
Is used to solve complex programming problems that are
repetitive in nature
Is implemented in a program by using a recursive procedure or
function. A recursive procedure or function is a function that
invokes itself
Is useful in writing clear, short, and simple programs
Answer:
There is no terminating condition in the given recursive
algorithm. Therefore, it will call itself infinitely. The correct
algorithm would be:
1. If (n = 1)
Return(1)
2. s = n + Sum(n – 1)
3. Return(s)
Time/Space Tradeoff:
It refers to a situation where you can reduce the use of memory
at the cost of slower program execution, or reduce the running
time at the cost of increased memory usage.
Example is data storage in compressed/uncompressed form.
Memory is extensible, but time is not. Therefore, time
considerations generally override memory considerations.
Microsoft Word
Document
Problem Statement:
You need to write an algorithm to search for a given word in a
dictionary. Discuss how different algorithms and different ways
of organizing the dictionary data affect the efficiency of the
process.