Common student exercises in computer science

From Citizendium
Jump to navigation Jump to search
This article is developing and not approved.
Main Article
Discussion
Definition [?]
Related Articles  [?]
Bibliography  [?]
External Links  [?]
Citable Version  [?]
 
This editable Main Article is under development and subject to a disclaimer.

Computer science, being a rather abstract science, likes to teach some of its principles using more or less concrete problems. These Scholary problems used for teaching in computer science are often not only intended as examples but also serve to lighten the mood and improve the recollection of the students. Often these problem appeared in a text book or article before becoming famous. Some of them (e.g. the Byzantine generals problem) even coined new terms (here: Byzantine error). Some of these problems are:

Hello World
Write one of the smallest possible programs printing "Hello World" on the screen. Simple problem to show syntax.
Eight queens problem
Arrange eight queens on a chess board so that none can capture the others. The implementation of this problem uses recursion and backtracking.
Dining philosophers problem
Five philosophers want to eat spaghetti with five forks but each one needs two of them. Shows the concepts of deadlock and starvation(!).
Byzantine generals problems
A number of locally distributed byzantine generals try to reach a consensus on when to attack a superior enemy. But there are traitors amongst them. Demonstrates failure scenarios where fault tolerance becomes difficult.
Is a square a rectangle?
Most object-oriented programming languages just say "No"! Example used to explain why combining inheritance and specialization relationships into the subclass relationship might not have been such a good idea after all.
Bus paradox
Does a bus (with wheels) with poisson-distributed inter-arrival times arrive every λ or every two λ? Shows the fallacies of not seeing the trap in the professor's logic in probability theory.