Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
7 votes
1 answer
330 views

Custom container for iterating over combinations of elements from multiple sets

Motivated by some SO quesitons [1, 2] I made an attempt at implementing a custom container with a bi-directional custom iterator for iterating over all combinations of elements from multiple sets. I ...
AMA's user avatar
  • 201
5 votes
2 answers
76 views

Filter queries three orders of magnitude slower than insertions

As part of a C++ library, I'm implementing a filter class for approximate set membership and abundance queries. The filter has two primary operations: ...
Daniel Standage's user avatar
4 votes
1 answer
911 views

Fast insert unique container

I posted the same question at StackOverflow then I got an advice to post it here. Original question: https://stackoverflow.com/questions/49998297/fast-insert-unique-container I have to store ...
Sekkmer's user avatar
  • 41
3 votes
3 answers
132 views

Fill in workbook with data from another workbook

Followup to this question I made a macro that will fill in data in a workbook that has 65 (24 are user filled) columns and can go as long as 1500 rows. The macro can import about 1500 rows and 24 ...
rzenva's user avatar
  • 73
3 votes
1 answer
296 views

Finding the lowest possible number of changes to turn one string into another

I've been working on a task: I have two giant strings, both consist of the same characters just scrambled (both consist only capital english letters). The task is to find the lowest possible number of ...
Mgols's user avatar
  • 31
4 votes
1 answer
86 views

Fill a new Workbook with info from another workbook

I made a macro that will fill in data in a workbook that has 65 (24 are user filled) columns and can go as long as 1500 rows. In an ideal scenario, the workbook has a perfect column that could work ...
rzenva's user avatar
  • 73
4 votes
0 answers
127 views

C++11 Removable connection from emitter or receiver object

Please review my solution for the following problem. I am interested in: Maintainability Usability Logical correctness Efficiency Problem: It has 1+ objects each in separated thread and between the ...
István Simon's user avatar
5 votes
1 answer
2k views

Complete ObservableDictionary

In conjunction with a recent question of mine, I found that an ObservableDictionary would be very handy for my situation, so I decided to implement one. I've ...
Denis's user avatar
  • 8,508
2 votes
2 answers
1k views

Set, List and Map equality comparison with Lambda check

I'd like to be able to compare two objects with different equality checks. This should work if they're in a Set, List or ...
Kalle Richter's user avatar
5 votes
2 answers
5k views

Example of adding STL iterator support to custom collection class

I'm trying to create an example of a custom collection with an API meeting the requirements of STL iterator templates, as a learning experience. The collection used here, a ring buffer, is merely a ...
AnotherSmellyGeek's user avatar
5 votes
1 answer
132 views

C++ container — variable byte coded numbers list

I'm writing a container for unsigned integers, which uses variable byte coding. It works but some decisions I took look ugly so I would be glad if you gave me some hints for improving the design. I ...
jazzandrock's user avatar
1 vote
1 answer
65 views

Create numerical-key array from existing string-key array, with a given string-key as first item

I have an array of available languages for my website, with a short ISO country code as the key for each language. I need to create a new array that contains the same info, but with numerical keys and ...
Magnus's user avatar
  • 163
6 votes
2 answers
1k views

Iterator of Container of Container

Based on this question I though I would pull together an iterator that iterated over a container of containers. ...
Loki Astari's user avatar
  • 96.6k
1 vote
1 answer
2k views

Returning containers from function - C++ [closed]

I've been trying to implement a few interfaces for processing data. And most of the time I do new of container and return a smart pointer to this container. ...
Shivendra Mishra's user avatar
3 votes
1 answer
74 views

Python JIT container type

This is a follow on from this review. Where I am attempting to improve the performance of my rest client. I have created an container type (as suggested in my previous post) that lazily instantiates ...
James Schinner's user avatar
0 votes
1 answer
59 views

Find combinations of items in a nested collection

It's a very typical problem that I come across here and there. Imagine that you have a collection of items of any type, and sometimes items are collections themselves; you then need to "expand" them ...
rishat's user avatar
  • 445
1 vote
2 answers
114 views

Given a list containing dates and the amount spent on each date, display the total amount spent per month

I had an interview yesterday where I was asked to write a function that would take in a list containing a date and the amount of money spent on that date, and to output the total amount spent per ...
Eoin's user avatar
  • 263
1 vote
0 answers
2k views

Custom dictionary class for reading and writing json value to a file

Is my implementation good? The program works as planned, but I wonder if some parts of the code can be made cleaner or more efficient. The file output looks like this: ...
KamRon's user avatar
  • 11
0 votes
1 answer
1k views

Scala type matching map

I was working with some complicated generics system, and I found the need to make an abstraction for a typesafe mapping between K[T] and V[T] where T is the same for individual pairs. In the case ...
Phoenix's user avatar
  • 267
6 votes
1 answer
30k views

Map with case insensitive get, remove and containsKey

I am looking for a Map implementation (with String keys and any generic type for values) that would support getting, removing ...
user avatar
2 votes
1 answer
96 views

Getting single element or throwing one of two exceptions

Sometimes I need to get a single thing from a collection but I'm not very happy with the Single extension. It does not differentiate between empty and more than one ...
t3chb0t's user avatar
  • 44.3k
2 votes
1 answer
1k views

VBA: Loop all .xlsx files in a folder and produce a list of worksheets and workbooks contained therein

I pieced together this code in answer to the following OP post on Stack Overflow: Get worksheet Names of All .xlsx files in a folder Task: The OP basically wanted to loop all .xlsx files in a folder ...
QHarr's user avatar
  • 375
2 votes
2 answers
189 views

Vector replacer

I rolled an own vector-like construct with improved performance and got it reviewed. Here is the updated version. ...
Mango's user avatar
  • 485
2 votes
1 answer
3k views

Vector-like custom container with improved insert performance

I rolled a little container class (just for couriosity) which was meant to be able as a vector replacement in some cases. (Whoever wonders about the lack of move semantic etc, I just left it out due ...
Mango's user avatar
  • 485
5 votes
2 answers
323 views

General FizzBuzz in Scala

I wanted to create a FizzBuzz implementation that both showcases the strengths of Scala (Functional paradigm and collections) and is general enough to anticipate the typical interview follow-up ...
Taylor's user avatar
  • 53
1 vote
1 answer
337 views

Array Wrapper Class

I’ve wrote a small array wrapper class which mimics the built-in Collection for adding and retrieving items. Once the object is created, you set the array capacity and that would not change. ...
Kostas K.'s user avatar
  • 215
2 votes
2 answers
120 views

Optimise many namedtuple assignment statements [closed]

I'd just like to know if there's a way I can reduce the number of namedtuple assignment statements in the code below. The actual program has over 60 assignment ...
Kei's user avatar
  • 39
1 vote
1 answer
4k views

Generic Comparator

I have tried to make a generic comparator with the use of reflection, but I am not sure how efficient it is or if it is the right way to do so Also, I don't know how it will handle dates. ...
Amol's user avatar
  • 111
1 vote
2 answers
106 views

PHP port of Java collections

...
thexiv's user avatar
  • 11
2 votes
0 answers
582 views

Flattening a map into a list of records

In my everyday work I'm trying to move away from traditional iterating over collections to a more Java 8 streams-like behavior. I'm currently working on a project where I have a collection defined as: ...
Jiinxy's user avatar
  • 129
4 votes
2 answers
2k views

Implementing an HotelManager interface in Java

Got a mission to implement an Hotel Manager interface. I will post the interface and the attached class Reservation, and will add my code. What I am asking you is ...
NotSure's user avatar
  • 149
2 votes
1 answer
2k views

Filtering a log file and extracts by different properties

I have implemented a program to extract a log file which contains a header line, followed by zero or more data lines, in comma-separated value format. The file consists of 3 columns. The first column ...
Anonymous's user avatar
  • 123
0 votes
2 answers
45 views

Removing objects from a list that don't appear in a list of ID's

I have a list of objects with each of them having an ID. I have a second list that is just a list of media ID's. I want to remove the objects from the first list that don't match a mediaID contained ...
Jvalant Dave's user avatar
1 vote
1 answer
57 views

JointIterable: iterates over all elements of a list of collections

I have this small utility class that allows me to iterate over a series of collections. Please tell me anything that comes to mind. JointIterable.java ...
coderodde's user avatar
  • 29.8k
3 votes
1 answer
207 views

Sorted vector/set class that works with simple types (char, int, double, etc...)

I'm new to C++ (approx. 3 months) and have just read Stroustrup's Programming Principles and Practice. Previously used Python a lot. As an exercise I tried to implement a custom container, with the ...
Fernando's user avatar
  • 133
4 votes
3 answers
579 views

Counting votes for candidates in a category and region

With the following code, I want to count the Vote objects from a collection, filtering on one of their fields, Candidate. I have the feeling that I can get this done much more efficiently. ...
mrkflp's user avatar
  • 83
0 votes
2 answers
3k views

Variadic template class that stores a vector of each type given [closed]

I'm exploring the possibility to generalise a class of mine that stores some entities. I like it to be able to keep entities of several type, given as template arguments. To explore the possibilities ...
dani's user avatar
  • 157
0 votes
2 answers
164 views

User and group management access to main class

UserGroup is not the main class. I don't really mind putting these classes in a class as they are related. I would still like to break them out. Problem I have is if I put ...
paparazzo's user avatar
  • 6,026
2 votes
1 answer
130 views

Unsafe collection which allows immutable access while also allowing push()

To get myself used to writing unsafe code, I wrote a collection which allows the user to keep immutable references to the elements of a vector while still being ...
lncr's user avatar
  • 125
3 votes
1 answer
14k views

Generate JSON for Map<String, Map<String, List<String>>>

Consider I have a String: ...
Seemant Shukla's user avatar
2 votes
1 answer
1k views

Method to return statistics from a collection with O(1) time and space

I have a DelayQueue, and the goal is to collect statistical information from the collection in O(1) time and space from ...
Mario Tim's user avatar
3 votes
2 answers
1k views

Case insensitive string to replace custom comparers

In some solutions I use case-insensitive strings a lot and so far I've been always writing custom collections or using custom comparers to support them. This is usually a lot of work and a lot of ...
t3chb0t's user avatar
  • 44.3k
2 votes
1 answer
441 views

C++11 lock free collection similar to std::forward_list - follow-up 2

Thread safe and lock free collections are very hard to write, so I'd appreciate any feedback, especially regarding bugs. The code below is a self contained hpp, followed by some tests. This question ...
Brent's user avatar
  • 451
8 votes
3 answers
5k views

Piling Up with Python

This is my solution for a Hackerrank problem. The problem was: There is a horizontal row of cubes. The length of each cube is given. You need to create a new vertical pile of cubes. The new pile ...
MSeifert's user avatar
  • 740
10 votes
4 answers
7k views

Powerset (all subsets of a set) in Java

I am trying to get a powerset (all subsets of a set) in Java. So my logic for that is: A given set is one subset, so add so it as it is to result. Remove each element of set from given set and we ...
Satyen Shimpi's user avatar
8 votes
2 answers
649 views

WeakCollection<T> class

Occasionally I have need for a collection of objects in which each object is referenced "weakly" (meaning the GC is allowed to collect it even when the object is in the collection). Traditionally, I ...
Walt D's user avatar
  • 181
7 votes
1 answer
2k views

Implementation of fixed size queue using a ring (cyclic) buffer

I found myself in need of a fixed size queue and decided to implement one using a ring (cyclic) buffer. I have tried my best to match the API of std::queue with ...
Emily L.'s user avatar
  • 16.6k
2 votes
1 answer
83 views

Get application credentials from linked array obtained from Cloud Foundry API

I am new to Java and I use the following code to retrieve parameters from a linked hash map from the Cloud Foundry API. My question is if there is a better way to do it in Java? ...
Rayn D's user avatar
  • 227
9 votes
2 answers
4k views

Fixed size dictionary to achieve performance goals

In my open source project, I have code that uses a dictionary very intensively so a system dictionary implementation did not suit me due to performance reasons. Therefore, I decided to write my own ...
Alexander Egorov's user avatar
5 votes
1 answer
148 views

Allowing switching between operator[] and at() based on NDEBUG macro version

The problem: std::vector and other containers have two functions for accessing / modifying their content: operator[] and ...
gaazkam's user avatar
  • 581

1 2
3
4 5
8