A robber burgles a butcher's shop, where he can select from some items. He knows the weights and prices of each items. Because he has a knapsack with
Continue ReadingC++: Move-To-Front Algorithm
Given a symbol table of a zero-indexed array of all possible input symbols this algorithm reversibly transforms a sequence of input symbols into an ar
Continue ReadingC++: Mad Libs
Mad Libs is a phrasal template word game where one player prompts another for a list of words to substitute for blanks in a story, usually with funny
Continue ReadingC++: Empty Program
In this task, the goal is to create the simplest possible program that is still considered "correct." int main(){} SOURCE Content is available un
Continue ReadingC++: Execute HQ9+
Implement a HQ9+ interpreter or compiler. Basically the same as the C example, although this has been C++'ified with strings and streams. void
Continue ReadingC++: Execute Brain****
RCBF is a set of Brainf*** compilers and interpreters written for Rosetta Code in a variety of languages. Below are links to each of the versions o
Continue ReadingC++: 100 Doors Problem
Problem: You have 100 doors in a row that are all initially closed. You make 100 passes by the doors. The first time through, you visit every door and
Continue ReadingC++: Loop Over Multiple Arrays Simultaneously
Loop over multiple arrays (or lists or tuples or whatever they're called in your language) and print the ith element of each. Use your language's "for
Continue ReadingC++: Find the Missing Permutation
These are all of the permutations of the symbols A, B, C and D, except for one that's not listed. Find that missing permutation. (cf. Permutations)
Continue ReadingC++: Knight’s Tour
Problem: you have a standard 8x8 chessboard, empty but for a single knight on some square. Your task is to emit a series of legal knight moves that re
Continue Reading