All Questions
Tagged with array performance
320 questions
0
votes
0
answers
18
views
Identifies connected elements and faces in FE mesh
So I'm conscious that this is a weak appeal for best practices. I'm building a converter that moves generic FE meshes to an inhouse edge format in Fortran and at some point I made a truly diabolical ...
6
votes
7
answers
1k
views
Filter non-even elements from an array
I have a method that returns an int[]. The array is made by filtering out only the even values of the array passed into the method.
It works, but it's really ugly ...
3
votes
1
answer
91
views
Merge discrete integer intervals
What it does
The code starts with a set of integer intervals, and can add new intervals (possibly by updating existing intervals). Essentially, it is a bit array whose index starts at ...
7
votes
3
answers
990
views
Dynamic Arrays with Count / Capacity in C
I write in C for several projects (e.g. learning / teaching,
coding competitions, data processing) and frequently need
arrays (e.g. strings) with fast appending / concatenation / reversing.
I've ...
3
votes
2
answers
86
views
Optimize Working Live Search & Highlight Function
I've written a custom Live Search & Highlight function in vanilla JS. It is working and does what I expect it to.
The issue is that the more items I add to the page content to search, the slower ...
5
votes
2
answers
977
views
Optimized data structure mapping finite set of integers to values in C++
I'm looking for a mapping data structure, but knowing that the possible values of my keys are small numbers, I would like to trade memory for better performances (for both random access and value ...
1
vote
1
answer
112
views
"stray" point correction in 2D array
I have a code which does the following:
For each value v in a 2D array, look at neighboring positions - how far to look is specified by distThreshold. If the count ...
4
votes
4
answers
1k
views
Merging sorted integer arrays (without duplicates)
I have written a Python function called merge_arrays which takes two lists and returns the new list merge without duplicate.
The function works as expected, but my ...
3
votes
2
answers
324
views
Given an array, remove zero or more elements to maximize the reduction where you add odd values and subtract even values
Here's a code challenge I got. (I could not solve the challenge, I ran out of time. I rephrased the challenge language and I am trying the challenge again for personal growth & computer science ...
2
votes
1
answer
85
views
Implementing an improved merge sort that uses insertion sort, with "levels" - Would this work correctly?
We were asked to improve the merge sort algorithm by introducing insertion sort to the code. We have been tasked with doing this by utilising a "levels" logic. Here is the exact description ...
3
votes
0
answers
59
views
extracting values from an array of nested objects without duplicates
I have my solution for the below usecase but I would like to know whether is any other effective solution for the same.
My Data:
...
2
votes
2
answers
71
views
Given a sorted list of integers, find the highest count of elements between an indeterminate but fixed size range
I'm trying to optimize a function that takes a sorted list of integers and tells me what is the maximum number of elements in the list between any definite size range. To be clear, the range itself ...
1
vote
1
answer
184
views
swap two different length group of variable in array
The code below swaps two different-length groups of variables of the same array in the same array.
Is there any other method to achieve this that is less heavy or less redundant?
...
5
votes
2
answers
146
views
concatenate values and delete the remaining rows using arrays
the below code used to:
Concatenate the values on a specific column "N" depend on the value of column "A" then delete the remaining rows.
It works, but with range of 30k rows the ...
2
votes
2
answers
193
views
Quick Sort Program
Quick sort is a sorting algorithm in which we select any random element as pivot from the array and we do the partition of the array around that pivot. Basically we place all the elements smaller than ...