prefix-sum Questions

5

Solved

I need to implement a prefix sum algorithm and would need it to be as fast as possible. Ex: [3, 1, 7, 0, 4, 1, 6, 3] should give: [3, 4, 11, 11, 15, 16, 22, 25] Is there a way to do this usin...
Phototherapy asked 14/5, 2012 at 16:44

11

I wonder if there is a better way of generating a better performing solution for partial sums of an array. Given an array say x = [ 0, 1, 2, 3, 4, 5 ], I generated sub-arrays of the items, and the...
Impute asked 10/6, 2019 at 0:11

2

Solved

I am trying to grasp the idea behind the prefix sum concept looking at the example presented in the Prefix Sum Lesson by Codility here (The mushroom picker problem) My understanding is that the who...
Merline asked 31/10, 2016 at 3:56

1

Solved

I have two vectors, a[n] and b[n], where n is a large number. a[0] = b[0]; for (i = 1; i < size; i++) { a[i] = a[i-1] + b[i]; } With this code we try to achieve that a[i] contains the sum of ...
Noelnoelani asked 6/3, 2016 at 1:2

2

Solved

Is there any data structure which is able to return the prefix sum [1] of array, update an element, and insert/remove elements to the array, all in O(log n)? [1] "prefix sum" is the sum of all ele...

3

Solved

I've been teaching myself functional programming, and I'm currently writing different higher order functions using folds. I'm stuck implementing scan (also known as prefix sum). My map implementati...
Prothalamium asked 11/2, 2010 at 10:29
1

© 2022 - 2024 — McMap. All rights reserved.