CS 241: Data Organization using C
Computer Science Department
University of New Mexico
|
|
Course Description
CS-241 is an introduction to the C Programming language, an introduction to using a command-line interface i
n the Linux operating system, and an introduction to machine level data organization and memory allocation.
Students taking this course should already be familiar with basic concepts of computer programming such as
variables, conditional control flow and loops. Developing mastery of these fundamental concepts is one of the goals
of CS-241. Students in CS-241 author many C programs: Lab assignments will be short and relatively simple.
Projects will be more interesting and touch on a wide range of computer applications including
encryption, numerical analysis, databases, artificial intelligence, genetic algorithms and games.
Many examples used in this course involve standard data structures such as linked lists and trees.
However, mastery of such data structures is not within the course’s domain.
The primary goals of CS-241 are for the student to be able to:
- Read and apply the C syntax covered in the textbook (The C Programming Language by Kernighan and Ritchie).
- Without a computer, determine the output of C language source code involving triply nested loops,
conditional control flow, function calls, pointers, arrays, arithmetic, logical and bit operators,
tructures and memory allocation.
- Use a Linux command-line environment to manipulate files, and directories, and to edit, compile,
run and debug C programs. This includes the use of simple makefiles and a low level debugger such as valgrind.
- Implement, in C, any given algorithm with a complexity level equivalent to that of
quicksort or a doubly linked list with accuracy, efficiently and clarity.
Prerequisite Skills
However, what you really need is:
- A solid grasp of basic control flow (if, else if, for, while, ... or equitant) in any programming language:
Java, Matlab, Fortran, Basic, Python....
- A solid base in Algebra I. If solving linear equations with one or two variables on paper has you scratching your head,
then you need more math before attempting this course. You can sign up, but you will just be donating tuition dollars to UNM.
I have never seen anyone pass who started the course while struggling with linear equations.
The most likely path to success with the first few CS courses at UNM is: CS-105 → CS-152 → CS-251 → CS-241.
Syllabus
Week 1:
Week 2:
- Variables, Loops and Arrays
- digitHistogram.c Example program based on section 1.6 of textbook. It reads a line and reports the number of occurrences of each digit.
-
Conditional Control Flow
-
Lab 2: Sum of 4 digit numbers on line
- lineSum.in This is the input file on which your program will be graded.
- lineSum.out This is the required output of your program when given lineSum.in as input file on which your program will be graded.
- C Programming Tutorial for Beginners by Mike of Giraffe Academy This is a long (4 hour) video, but you would not need to watch all of it this week.
Mike uses an IDE called Code::Blocks. We are not using an IDE, so you can skip stuff where he talks about Code::Blocks. Also, for this second week, only watch the first 1 hr 17 minutes (stoping at "Building a Mad Libs Game").
Even this first part of the video covers stuff we are not covering until later such as scanf and the ampersand, &, address-of operator, but it is good to get a preview of those topics.
Week 3 & 4:
Week 5:
Week 6:
Week 7:
Week 8: (fall break Thursday and Friday)
Week 9:
Week 10:
Week 11 & 12:
Week 13:
Week 14:
- Tron (with jump).
- tron.h
- classFunctions.c Comment out the three functions with your name an implement in a different tron_yourlastname_yourfirstname.c
- libmcp.a Master Control Program Lib. Compile with: gcc *.c -L. -lmcp -lm -lpthread `sdl-config --libs` -lSDL_ttf -o tron
Past Exams: