How to solve this algorithm math homework help
How to solve this algorithm math homework help
Consider the following algorithm.
for i {1, 2, 3, 4, 5} do | |||||
beep | |||||
for
j {1, 2, 3} do |
|||||
beep | |||||
for
k {1, 2, 3, 4} do |
|||||
for
l {1, 2, 3, 4} do |
|||||
beep | |||||
for
m {1, 2, 3, 4, 5, 6} do |
|||||
beep |
How many times does a
beep statement get executed?
2. Consider the following algorithm.
x â† 1 | |||
for
i {1, 2, 3, 4} do |
|||
for
j {1, 2, 3, 4, 5} do |
|||
x â† x + x |
|||
for
k {1, 2, 3} do |
|||
x â† x + 1 |
|||
x â† x + 5 |
Count the number of + operations done by this algorithm.