All Questions
15
questions
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.
...
4
votes
1
answer
101
views
Immutable Keyed Set
Description
An immutable keyed set is a readonly collection of elements without
duplicates or null values having each of the elements linked to
exactly one key.
Example
This simple example ...
3
votes
1
answer
135
views
Generic Macro Generated Hashset in C
The Hashset uses open addressing, linear probing and Robin Hood hashing for handling collisions. It comes with insert and remove ...
4
votes
2
answers
1k
views
Custom Hashset in Java
I have written this custom hashset and though it isn't completed yet, I would like to know if there is anything I am overlooking in terms of clean code conventions. My aim was also to apply generics ...
3
votes
1
answer
110
views
unordered_set: a hash table -based set data structure in C89
In this post, I present a hash table -based set data structure written in C89:
unordered_set.h
...
0
votes
1
answer
107
views
java.util.Set extension/implementation
Lately, I was working on some experimental java.util.Set extension, IdSet:
...
7
votes
1
answer
3k
views
Sort int array by frequency then value
Problem
Take an array of ints as input and run a special sorting algorithm on it. This algorithm must first sort by int frequency, less frequent first, then sort by value.
For example ...
4
votes
2
answers
4k
views
Data Structures for Counting Duplicates and using std::vector::erase
Problem
Dupe detection for a vector of ints. I simply want a count of the unique input characters that occurred at least twice. The goal is to count a dupe only once and ignore that input character if ...
3
votes
1
answer
3k
views
Thread safe tbb::concurrent_hash_map and std::set
I have a basic websocket server implemented in C++. I'm using Intel TBB's concurrent hash_map to store all the users, uniquely identified by the id. The concurrent ...
5
votes
1
answer
245
views
Finding added keys, removed keys, and unchanged keys in ordereddict
I'm comparing two OrderedDict objects and I need to find added keys, removed keys, and keys that are present in both (the intersection). Sets are designed for ...
2
votes
0
answers
147
views
Spellchecker program is having issues due to vowel checking method
This program takes in a list of 275k or so words from '/usr/share/dict/words' and loads them into HashSet. It then takes in a list of 1000 words (taken from the dictionary and are scrambled (vowel ...
2
votes
1
answer
649
views
Dictionary with ISet key as a collection of names
I'm writing a command-line utility and I need to find commands (and parameters) by name. The name can either be a full name like save or a shortcut ...
3
votes
1
answer
314
views
Duplicate integers in an array
Code shows duplicate values of integers in an array with indexes and the number of occurrences. Can you please critique my code and provide your thoughts on where I should improve my code?
...
5
votes
2
answers
896
views
Find the rarest in a map
Write a method rarest that accepts a map whose keys are strings and
whose values are integers as a parameter and returns the integer value
that occurs the fewest times in the map. If there is a tie, ...
2
votes
1
answer
219
views
Iterate over items in a set of dicts
I'm using the following code to initialise 8 I/O-ports (i.e. GPIO pins on a Raspberry Pi). That's 4 x 2 pins, each duo controls a switch, A to D, and each duo consists of a pin for On and a pin for ...