Projeto de Algoritmos

Prefácio

Este é um pequeno curso de projeto e análise de algoritmos e de estruturas de dados básicas.  Os algoritmos são escritos em C;  é preciso, portanto, que o leitor tenha alguma familiaridade com essa linguagem de programação.

Eu tenho usado estas notas na disciplina MAC0122 (Princípios de Desenvolvimento de Algoritmos) no Instituto de Matemática e Estatística da USP.   Essa disciplina é obrigatória no currículo do Bacharelado em Ciência da Computação.

 


Dijkstra e o ensino de computação/programação

"Computer science is no more about computers than astronomy is about telescopes."
—Edsger W. Dijkstra

Edsger W. Dijkstra tinha opiniões firmes e originais sobre o ensino de programação e de computação. Acho que é apropriado citar aqui alguns trechos do manuscrito EWD1036  (eu enfatizei algumas frases):

"So, if I look into my foggy crystal ball at the future of computing science education, I overwhelmingly see the depressing picture of "Business as usual". The universities will continue to lack the courage to teach hard science, they will continue to misguide the students, and each next stage of infantilization of the curriculum will be hailed as educational progress."
"We could, for instance, begin with cleaning up our language by no longer calling a bug a bug but by calling it an error. It is much more honest because it squarely puts the blame where it belongs, viz. with the programmer who made the error. The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation. The nice thing of this simple change of vocabulary is that it has such a profound effect: while, before, a program with only one bug used to be "almost correct", afterwards a program with an error is just "wrong".
"The statement that a given program meets a certain specification amount to a statement about all computations that could take place under control of that given program. And since this set of computations is defined by the given program, [we must] deal with all computations possible under control of a given program by ignoring them and working with the program.  We must learn to work with program texts while (temporarily) ignoring that they admit the interpretation of executable code."
"Needless to say [that] all by itself, a program is no more than half a conjecture. The other half of the conjecture is the functional specification the program is supposed to satisfy. The programmer's task is to present such complete conjectures as proven theorems."
"Right from the beginning, and all through the [introductory programing] course, we [should] stress that the programmer's task is not just to write down a program, but that his main task is to give a formal proof that the program he proposes meets the equally formal functional specification.  [...]  Finally, in order to drive home the message that this introductory programming course is primarily a course in formal mathematics, we see to it that the programming language in question has not been implemented on campus so that students are protected from the temptation to test their programs. And this concludes the sketch of my proposal for an introductory programming course for freshmen."

"In Pursuit of Simplicity",
coleção de manuscritos de Edsger W. Dijkstra

 


URL of this site: www.ime.usp.br/~pf/algoritmos
Last modified: Mon Feb 5 06:36:27 BRST 2007
Paulo Feofiloff
DCC do Instituto de Matemática e Estatística da USP