Skip to main content

All Questions

Tagged with
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 ...
Piotr Siupa's user avatar
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,...
verven's user avatar
  • 41
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 ...
Samir's user avatar
  • 143
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 ...
greg's user avatar
  • 1,017
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 ...
greg's user avatar
  • 1,017
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 ...
fatffatable's user avatar
3 votes
1 answer
205 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
3 votes
1 answer
6k views

Set class with binary search tree implementation

Here is my Set implementation with binary search tree that compiles. Please let me know what changes are needed to make it better. Thank you. ...
user avatar
3 votes
2 answers
2k views

Set with custom compare

In my project I use std::set with custom Compare function for maintaining an event queue. It fulfills following criteria: event duplication is not allowed should ...
pergy's user avatar
  • 131
6 votes
2 answers
2k views

Building a set of all subsets recursively in C++

Here is my recursive implementation of a power set function in C++. One thing that concerns me is that I am iterating over the set of sets while modifying its size. The code nevertheless functions as ...
user11881's user avatar
  • 393
3 votes
0 answers
124 views

Substitute for `std::array::operator[]` in C++11 by using template-based recursion

What follows is a simplified version of a tentative implementation for a template-based set, named TemplateArgs. For the sake of clarity and focus on the question ...
Flávio Lisbôa's user avatar
2 votes
1 answer
532 views

Union Find implementation

I am trying to complete this challenge. The user should enter a sequence of instructions, = to link two numbers, and ? to query ...
cpp beginner's user avatar
3 votes
0 answers
194 views

Conways Game of Life using unordered set of coordinates

Previously I had been using an array of bool(dead/live) to represent cells. I looked on code review to see how other people have implemented Conway's Game of Life. Someone in the comments of a post ...
dylan's user avatar
  • 397
3 votes
1 answer
835 views

Persistent set (Red black tree)

This is a partially persistent data structure using a red black tree. It will copy \$O(lg(n))\$ items for each remove or add operation. ...
MAG's user avatar
  • 2,944
3 votes
2 answers
2k views

Get missing letters - TopCoder challenge

I'm working on a TopCoder problem which seeks to find the letters preventing an input sentence from being a pangram in all caps, alphabetical order. MissingLetters.h ...
erip's user avatar
  • 926

15 30 50 per page