Understanding Write-Read Operations in Iterative Algorithms
This document describes the write-read operations in iterative algorithms through practical examples. We explore two scenarios using an array manipulation technique, highlighting the initial state and iteration sequences. The first example demonstrates how to read from and write to an array, showing the changes in values over iterations. The second example focuses on writing back to the same array, revealing the resulting values after each iteration. By analyzing these examples, we gain insights into the behavior of data manipulation in algorithms.
Understanding Write-Read Operations in Iterative Algorithms
E N D
Presentation Transcript
Example A: write_read(&a[0],&a[1],3) Initial Iter. 1 Iter. 2 Iter. 3 cnt 3 2 1 0 a –10 17 –10 0 –10 –9 –10 –9 val 0 –9 –9 –9 Example B: write_read(&a[0],&a[0],3) Initial Iter. 1 Iter. 2 Iter. 3 cnt 3 2 1 0 a –10 17 0 17 1 17 2 17 val 0 1 2 3