Introduction to computer science

Introduction to computer science

Source code from class

The preparation classes will be in room 717 on Thursday 5.2.09 at 16:00 and on Friday 6.2.09 at 10:00

Exams from previous years

syllabus

first homework



Lecture notes

Topic Slides Source files Recitation
Introduction first class slides "I am a computer." source code
Quadratic equation source code
version taking care of more options
version with a better structured source code
slides
syntax second class slides ascii of '0' source code
sizeof source code

division the wrong way
the wrong correction
the right correction
swap without a temp variable
slides
control structures control structures slides gcd 1 2 3
computing a sum with while and with for
nested for
cycle in a permutation
switch example
repeating the same char
4 digit numbers
sum of harmonic sequence
chessboard (4 nested FORs)
grade calculation
if
loops
functions functions slides
edges of a triangle
the same program with struct point
slides
data structures structures slides capitalizing a string
the program with struct simple_expression
person and date
1 2
array algorithms Array algorithm slides 1 2 3a 3b 3c 3d 3e 3f 3g 3h 3i 4 5
2005 homework
slides
strings Algorithms on strings slides. 1 2 3 4 5 6 slides
numeric analysis Numeric analys slides. inverse function
Lion in the desert
circumference of an oval
pointers pointers slides swap the wrong way
correction
swap function the wrong way
swap function with pointers
Here is the the comparison source code with the use of pointers. Note that this program is not necessarily better than the one with struct comparison
slides
memory allocation Dynamic memory allocation slides. 1, 2, 3 4, 5 6 slides
recursion recursion 1 2
sorting Bubble sort
Merge
Recursive sort using Merge

sum up


Download borland C here

Download Xemacs here

Exams from previous terms



Here is a sample final test and a proposed solution.
Here is a sample midterm test .
Solutions to question 1: this or this or this
Solution to question 2
Solution to question 3 and source code of part d

2006 midterm exam .

2007 midterm exam .

Exercizes from previous terms



Exercize 1

Exercize 2
solutions: 1 2 3 4

Exercize 3
solutions: 1 2 3

Exercize 4
solutions

Exercize 5

Exercize 6 (not for submition)

Questions from exams with linked lists, recursion and pointers

17.4.2008: 2006 Moed b test (with recursion)
13.4.2008 class code: 2006 test with question 4 solved and its solution to question 3 and 5
10.4.2008 class code: 2006 test and its solution
6.4.2008 class code: files
2.4.2008 class code: adding at end
30.3.2008 class code: towers of hanoi more recursive fuctions
27.3.2008 class code: recursive sort using merge
23.3.2008 class code: best friends linked list
20.3.2008 class code: x becomes ks date and person
16.3.2008 class code: merge seenbefore

Homework 4

Homework 5

(P.S. why do we alway get 6174?)

Homework 6

Here is the main function to chack your code.
Here is the output you should get.

Sample midterm
and solutions: 1 2 3

Homework 7

Here is a benchmark to check your code.
Here is the output you should get.