Skip to main content

All Questions

Tagged with
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 ...
Subject303's user avatar
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 ...
Otaku's user avatar
  • 161
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 ...
FromTheStackAndBack's user avatar
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 ...
Justin Chang's user avatar
  • 2,437
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 ...
codejp3's user avatar
  • 31
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 ...
Delgan's user avatar
  • 621
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 ...
andrewb's user avatar
  • 113
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 ...
TAHER El Mehdi's user avatar
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 ...
Nate Anderson's user avatar
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 ...
Preatorius's user avatar
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: ...
SM1312's user avatar
  • 131
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 ...
Tyler Schuster's user avatar
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? ...
Ill Magnus's user avatar
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 ...
Leedo's user avatar
  • 275
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 ...
Strange Alchemist's user avatar

15 30 50 per page
1
2 3 4 5
22