Consider the following pseudo-code algorithm: S:=0 for i:=1 to n for j :=1 to i S:=s+j.(i- j +1) next i next i 1. Make a
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Consider the following pseudo-code algorithm: S:=0 for i:=1 to n for j :=1 to i S:=s+j.(i- j +1) next i next i 1. Make a
Consider the following pseudo-code algorithm: S:=0 for i:=1 to n for j :=1 to i S:=s+j.(i- j +1) next i next i 1. Make a table or list that calculates how many iterations of the inner for loop there are for each iteration of the outer loop. (That is, when i = 1, how many "" loops will occur? How about when i = 2? Etc.) 2. Find an expression involving n that gives the total number of operations performed by the algorithm. 3. Determine the order of this algorithm.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!