problem

This tag is associated with 10 posts

Global Warming: Is It Really a Problem?

SOURCE

C++: Monty Hall Problem

Run random simulations of the Monty Hall game. Show the effects of a strategy of the contestant always keeping his first guess so it can be contrasted with the strategy of the contestant always switching his guess. Suppose you’re on a game show and you’re given the choice of three doors. Behind one door is … Continue reading »

C++: ABC Problem

You are given a collection of ABC blocks. Just like the ones you had when you were a kid. There are twenty blocks with two letters on each block. You are guaranteed to have a complete alphabet amongst all sides of the blocks. The sample blocks are: ((B O) (X K) (D Q) (C P) … Continue reading »

C++: Dutch National Flag Problem

The Dutch national flag is composed of three coloured bands in the order red then white and lastly blue. The problem posed by Edsger Dijkstra is: Given a number of red, blue and white balls in random order, arrange them in the order of the colours Dutch national flag. When the problem was first posed, … Continue reading »

C++: Josephus Problem

Josephus problem is a math puzzle with a grim description: n prisoners are standing on a circle, sequentially numbered from 0 to n − 1. An executioner walks along the circle, starting from prisoner 0, removing every k-th prisoner and killing him. As the process goes on, the circle becomes smaller and smaller, until only … Continue reading »

C++: 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 toggle the door (if the door is closed, you open it; if it is open, you close it). The second time you only visit every 2nd … Continue reading »

C++: Closest-Pair Problem

The aim of this task is to provide a function to find the closest two points among a set of given points in two dimensions, i.e. to solve the Closest pair of points problem in the planar case. The straightforward solution is a O(n2) algorithm (which we can call brute-force algorithm); the pseudocode (using indexes) … Continue reading »

C++: Dining Philosophers

The dining philosophers problem illustrates non-composability of low-level synchronization primitives like semaphores. It is a modification of a problem posed by Edsger Dijkstra. Five philosophers, Aristotle, Kant, Spinoza, Marx, and Russell (the tasks) spend their time thinking and eating spaghetti. They eat at a round table with five individual seats. For eating each philosopher needs … Continue reading »

C++: Knapsack Problem

A tourist wants to make a good trip at the weekend with his friends. They will go to the mountains to see the wonders of nature, so he needs to pack well for the trip. He has a good knapsack for carrying things, but knows that he can carry a maximum of only 4kg in … Continue reading »

Why Is Tax Dodging a Problem?

SOURCE

Become a TFE Insider!