Questions tagged [contiguous]
145 questions
0
votes
1 answer
32B chunks, contiguous and non-contiguous memory accesses
I wrote a matrix-matrix(32bit floats) multiplication function in C++ using intrinsics for large matrices(8192x8192), minimum data size is 32B for every read and write operation.
I will change the algorithm into a blocking one such that it reads a…

huseyin tugrul buyukisik
- 11,469
- 4
- 45
- 97
0
votes
1 answer
Finding contiguous points in an increasing range
I have a set of data points in a vector. For example,
[NaN, NaN, NaN, -1.5363, NaN -1.7664, -1.7475];
These data result from a code which selects 3 points within a specified range (specifically. -0.6 an 0.6). If three points from the column do…

TheMcCleaver
- 75
- 1
- 3
0
votes
2 answers
Attempting to dynamically allocate a multidimensional array in C results in a crash
For a multitude of reasons, I'd like to allocate multidimensional arrays in contiguous chunks of memory. I can do this by allocating them manually,…

Michał Gawlas
- 186
- 7
0
votes
2 answers
CRT memory allocation
Our application allocates large std::vector<> of geometric coordinates -
it must be a vector (which means contiguous) because it eventually sent to OpenGL to draw model.
And Open GL works with contiguous data.
At some moment allocation fails which…

IgorStack
- 799
- 2
- 6
- 22
-1
votes
1 answer
Replace contiguous duplicates by a set value, but only if length of contiguous range more than a threshold
What would be an efficient way to replace contiguous identical values in a list elements by another given value, but only if the the contiguous sequence runs for more than a certain number of elements (eg : more or equals to 5)
Example:
["red";…

Yahia
- 805
- 7
- 25
-1
votes
2 answers
The Perfect Square with BIT WISE AND
How to optimize the solution of counting number of perfect square of the of the contiguous sub arrays when bit wise AND operation is performed on the sub arrays.
The Time Complexity should be O(n) or O(n*logn).
Here is the naive approach
int…

shubham singh
- 511
- 1
- 5
- 16
-1
votes
2 answers
Dynamic matrix allocation - allocating a contiguous block of ints using malloc not working
I'm trying to create a 2D matrix of ints and allocate memory to the same using malloc().
I want the matrix to look like this: {{-4,0},{-3,0},{-2,0},{-1,0},{1,0},{2,0},{3,0},{4,0}}
But I want to be able to change it later, so I'm trying to…
-2
votes
1 answer
how can i find the longest subarray with a max difference of 0 and 1 with time O(n) and space O(1)
How can i find the longest sub array with a max difference of 0 and 1 with time complexity of O(n) and space of O(1)? Thank you in advance for the feed backs & solutions!
For example:
input array is {3, 3, 4, 5, 5, 5, 6, 6, 7, 7, 7, 7, 7} and…
-3
votes
1 answer
Somehow my values don't seem to all be inserting into a list
I am doing a homework assignment where I am supposed to use our professors contiguous list class to store a list of personal record which can then be printed or searched for a specific record. The personal record struct contains only member data for…

Victoria Potvin
- 127
- 1
- 11
-4
votes
1 answer
Largest sum of all contiguous subarrays
I have an exercise to solve: "Write an efficient C program to find the largest sum of contiguous subarray within an one-dimensional array of integers. A contiguous subarray of an array is defined as the sequence of elements that are in any…

Lorenzo Fabbri
- 15
- 1
- 4