All Questions
Tagged with set performance
16
questions
2
votes
4
answers
179
views
Comparison of two excel files ignoring line order
Below is a simple method which compares contents of two excel files ignoring the line order.
This method is working as expected.
But, one of my peers in their code review mentioned that initializing ...
4
votes
1
answer
892
views
Vectorset, a faster std::set
I decided to implement a vectorset, which is intended to be faster than std::set for the 3 fundamental operations, namely insert,...
2
votes
3
answers
223
views
Sort an array of integers with a hashset
I was trying to make a sorting algorithm for an array of integers. Here's are the steps/theory:
It turns an array into a HashSet, iterates over every integer value ...
6
votes
1
answer
430
views
Remove elements compared with other elements in a Set based on a condition
Simplified the actual problem to focus on comparing/removing performance.
Given a set S with n elements , find the most optimal way to compare each element to all others until a condition is met that ...
0
votes
1
answer
107
views
java.util.Set extension/implementation
Lately, I was working on some experimental java.util.Set extension, IdSet:
...
3
votes
1
answer
964
views
Extract index of first unique element in large array in Swift
I'm using the following code to return the first index of a unique character in a large String. It works fine until I get to large strings, where it times out.
Is ...
2
votes
1
answer
8k
views
Remove Duplicates from Array in Swift 3.0
I ran the following code through a Leetcode.com challenge and it says the runtime for the test cases is 119ms, which puts it at the back of the pack performance wise.
The goal is to remove duplicates ...
4
votes
3
answers
3k
views
Generate powerset in JS
I came across a mock interview question in which the candidate is asked to generate the powerset of a given set.
The input set is represented as a unique array of integers.
There was no solution ...
4
votes
4
answers
181
views
Increase performance of a method which finds the element removed from an array
Imagine that you have a TreeSet of numbers, and you copy them into an array, but you remove one element of it. You want to know the element removed.
...
8
votes
3
answers
3k
views
Two sets came to an intersection
Challenge:
Print set intersections.
Specifications:
Your program should accept as its first argument a path to a filename.
Each line in the file is a test case.
Each test case contain two ...
7
votes
4
answers
3k
views
Faster Way of Comparing Generic Sets
The following extension method is the limiting factor in the performance of an application I am developing, according to Visual Studio 2012 Performance Analysis profiler.
Is there a faster way to ...
5
votes
1
answer
3k
views
Producing the intersection of several sequences
Based on this SO answer I have created a method that produce the set intersection of several sequences:
...
3
votes
1
answer
188
views
Finding the 'Minimum' AND of all the possible subsets of a set
The subset size should be greater than or equal to 2.
How can I speed up this code?
...
7
votes
2
answers
2k
views
Using includes() vs. hash function to check if an unordered_set is a subset of another unordered_set
I did two methods to determine if an unordered_set is a subset of another unordered_set, using hashing, and the built-in ...
10
votes
2
answers
2k
views
boost::unordered_set intersection using templates
I wrote this function to do unordered_set intersection using templates. I have seen this answer but I thought that it was overkill. I would like the method to take ...