0:00:00.012,0:00:02.790 So let's turn to what implementations of scan look like, 0:00:02.790,0:00:05.885 and we're going to start off with the straightforward serial implementation. 0:00:05.885,0:00:11.422 So here's a serial implementation of inclusive scan. So let me tell you how this works. 0:00:11.422,0:00:14.860 We start off by initializing an accumulator variable 0:00:14.860,0:00:18.422 that's going to sum our partial results to the identity element. 0:00:18.422,0:00:22.641 And then we're going to loop through all the elements in our input array 1 at a time. 0:00:22.641,0:00:25.063 So at each step we're going to do 2 things. 0:00:25.063,0:00:28.891 The 1st thing we're going to do is we're going to take the current value of the accumulator 0:00:28.891,0:00:33.308 and we're going to apply the operation to it with the current element. 0:00:33.308,0:00:38.700 So this could be any binary associative operator--plus, times, max, min, and so on. 0:00:38.700,0:00:41.317 And we're going to store that value back in the accumulator. 0:00:41.317,0:00:44.454 Then we're going to set the output element at this particular position 0:00:44.454,0:00:47.903 equal to the accumulator, then move on to the next element. 0:00:48.779,0:00:51.428 Now, what we've just defined is an inclusive scan. 0:00:51.428,0:00:55.970 What we'd like you to do as a quiz is to convert this code to exclusive scan. 0:00:55.970,0:00:59.105 And this is fairly straightforward, so why don't you give it a shot.