Skip to main content

Questions tagged [set]

A set is a collection in which no element is repeated, which may be able to enumerate its elements according to an ordering criterion (an "ordered set") or retain no order (an "unordered set").

2 votes
1 answer
80 views

Compare and merge sets from unstructured variables for automatic differentiation

I have developed an automatic differentiation module for my software. Usually AD comes in two forms; forward mode or reverse mode and very clever approaches, beyond me, might mix both. Typically the ...
1 vote
1 answer
82 views

Rewriting the java.util.concurrent.ConcurrentSkipListMap to a version without concurrency constructs

I have essentially rewrote the java.util.concurrent.ConcurrentSkipListMap into a version without concurrency constructs (...
5 votes
4 answers
2k views

Duplicate words in a text

Here is a simplified implementation to obtain the duplicate words in a text using lambda expressions. ...
1 vote
1 answer
79 views

Collection that uses a bitset to store a huge set of unique integers from a given range (rev. 1)

Some (skippable) context: I'm writing program that minimizes an arbitrary logical function. Such function takes an unsigned integer as an argument and returns either ...
2 votes
0 answers
50 views

Set-like Operation in C - Advent of Code 2021 Day 3

I am relatively new to C programming and am currently completeing challenges of Advent of Code 2021 to elevate my skills. I am excited to share my solution for the puzzle on Day 3 and am eager to ...
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 ...
1 vote
1 answer
60 views

SortedIntSet: a set of integers that can be iterated in ascending order in O(N) time

I needed a set with the following properties: can be iterated in ascending or descending order in \$O(N)\$ time the usual set operations (contains, add, remove, discard) can still be done in \$O(1)\$ ...
3 votes
3 answers
155 views

IPv4 filter in Java

I have a simple class for representing IPv4-addresses via int values, and a simple IP-address filter that works like a set of IPv4-addresses. ...
8 votes
3 answers
143 views

Compressed output of set in Python

In order to provide a better output of sets with many consecutive elements (a similar class could be written for a list or tuple,...
2 votes
1 answer
190 views

Yet another Wordle Game

This Jupyter Notebook code for the Wordle game works. After a lot of fixes, I have it working as it should. The code is a jumbled mess. I am open to any suggestions and/or criticism of my code. I am ...
6 votes
4 answers
1k views

Monty hall python simulation

I have the following code that simulates the monty hall problem (see google for more details). I used sets to do it but is there a more intuitive or efficient way to do it? ...
4 votes
1 answer
893 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,...
1 vote
0 answers
79 views

A simple Java integer hash set - follow-up

(See the previous version.) (See the next version.) After incorporating changes in the previous post, I came up with this implementation. However, I left hashing as it is. ...
2 votes
1 answer
129 views

How many times element of one array occurs in another array?( HackerRank sparse arrays problem)

with basic knowledge of multiset and vectors in c++ I solved the following problem. How can I improve my code and also handle any input errors? Problem statement: There is a collection of input ...
2 votes
2 answers
148 views

Radio with channels

Realize the Radio and Channel classes that represent radio and a radio station. The radio class offers an argumentless constructor and the following methods: addChannel: stores and returns a new ...

15 30 50 per page
1
2 3 4 5
10