Computer programming
Course: Tue 10-13, A115
Lab: Wed 10-14, Thu 14-18, B418b
Office hours: Mon 11-12, B418a; Thu 18-20 B418; if needed Wed 12-14 B531, Thu 12-14 B531/B528
Tutoring: gr. 1.1: Mon 11h, B418a; gr 1.2: Tue 13h, C305/C211a; gr. 2.1: Thu 12h, C305; gr. 2.2: Thu 18h, B418a
Instructor: Marius Minea, marius@cs.upt.ro (Office: B531. Phone: +40-256-403284)
Lab assistant: ing. Alexandru Iovanovici
Lab grades
Exam grades
Homeworks
Upload your solutions
- Homework for week 3: problems 3, 4, 8 from Lab 2 page. Deadline: before lab.
- Homework for week 4: problems 5, 8 from Lab 3 page. Deadline: before lab.
- Homework 7. Due: by end of Thursday labs in week 7.
Midterm solutions: reverse bytes, reverse bits in bytes, print 4-digit groups, sum ints in string,
prefix expression, s-expression, see also postfix expression
Solutions for exam 1: different bits, 3-byte integers, maximum-width text, concatenate words (see also Lab 8), integer sequences (with realloc, with lists),
begin/end labels
Solutions for exam 2:
BCD numbers, base-26 numbers, rewriting strings, rewriting numbers, checking PDF.
Solutions for exam 3:
bits from string, word count, Fibonacci words, cut fields from file, cut words from stdin
Course materials
- Introduction. Recursion.
Sample program: Sierpiński triangle
- Recursion. Character input.
- Decision. Assignment. Iteration.
Sample programs: calculator, filter tags, check nesting.
- Iterative processing. Bitwise operators.
Variants for counting words on a line:
one inner loop,
two inner loops,
state machine.
- Internal representation. Bitwise operators.
count bits, reverse bits,
bitwise addition, stream bits, bitmap processing, float structure, division of Z2 polynomials
- Arrays.
- Input/output functions.
adding read integers with overflow check, adding integers on each line (version 1, version 2)
- Pointers
traverse array, traverse argv[], sort string table
- Pointers. Dynamic memory allocation
add cmdline numbers, concat argv[], eval string expression
- File I/O
print file, copy files,
list files from .zip,
half size image
- User-defined types
extended gcd, processing terms: just reading, with string args, with term args
- Abstract datatypes
intlist.h, intlist.c, lstmain1.c, listlib.h, listlib.c, lstmain2.c
- Lists (cont.). Exceptions
integer expression with exceptions; filter list, main program
integer queue, queue header, program using queue
- Application: SAT checking. sat.c intset.h intset.c. Check with problems from here
Laboratory
- Lab 1: Introduction. Recursion
Exercise: Write a program, similar to the one done in class, that draws
the Koch curve, as described here.
- Lab 2: Recursion. Character input
- Lab 3: Character processing
- Lab 4: Iterative processing. Bitwise operators
- Lab 5: Bitwise operators
- Lab 6: Arrays
Sample programs: multiply big numbers, reverse words, collapse string spaces, UNIX checksum
- Lab 7: Standard I/O
Sample programs: search input for word, process CSV input
- Lab 8: Pointers
Sample: concatenate words, add ints and floats
- Lab 9: Pointers. Dynamic allocation
Sample: arg handling in scanf, read array of lines
- Lab 10: Files
Sample: split file into chunks, find and replace
- Lab 11: Structures
Sample: continued fraction
- Lab 12: Abstract datatypes
Sample: remove duplicates from list
- Lab 13: Abstract datatypes
Sample: merge sort a list
Review
Resources
Marius Minea
Last modified: Wed Jun 3 17:00:00 EET 2014