Common student exercises in computer science: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Markus Baumeister
(Sorry just couldn't resist)
 
imported>Markus Baumeister
mNo edit summary
Line 8: Line 8:
; [[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.
; [[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.
; [[Is a square a rectangle?]] : Most [[object-oriented programming language]]s 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 distribution|poisson-distributed]] [[markov process|inter-arrival times]] arrive every λ or every two λ? Shows the fallacies of not seeing the trap in the professor's logic in [[probability|probability theory]].
; [[Bus paradox]] : Does a bus (with wheels) with [[poisson distribution|poisson-distributed]] [[markov process|inter-arrival times]] arrive every λ or every two λ? Shows the fallacies of not seeing the trap in the professor's logic in [[probability|probability theory]].

Revision as of 17:14, 13 March 2007

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.