These notes are for CSCI 2530, Introduction to Data Structures. Please see the course syllabus for details about the course and how you will be graded.
Here are some important points from the syllabus concerning programming assignments.
I expect you to test your software. If your software does not compile without errors, you cannot have tested it even once. Therefore, a submission that does not compile without errors will get a grade of 0, regardless of how close it is to compiling without errors. It is not my responsibility to fix errors in your software.
Teamwork is important, and there will be opportunities for you to work in teams in later courses. But teams are only effective when everyone on the team is competent and can contribute without constant supervision. That competence needs to be learned by working alone. You are expected to do your own work in this course.
Putting your name on someone else's work is plagiarism. Putting your name on work that is half yours and half somebody else's is plagiarism. If I believe that your work is plagiarized, you will receive a grade of −50/100 for that assignment. If two students submit work that could not possibly have been written independently, I will consider both submissions to be plagiarized.
You can appeal that decision if you believe that you worked alone. Just come to my office and talk to me about it.
By the way, getting something from the internet and slapping your name on it is a very bad idea. I have Google too. You are better off not submitting an assignment than resorting to plagiarism.
If you get stuck, do not give up. Ask questions. Give yourself time to ask questions by starting early and trying to finish early. Students who start early will give themselves a good chance to do well in this course. Students who habitually start late on assignments should give serious consideration to dropping this course now.
The goals of this course include the following.
In this course, you will learn to write computer software that involves creating physical data structures, such as linked lists and trees. You will develop and implement algorithms that work on those data structures, and apply them to solving computational problems.
Most students come into this course with a novice's ability to design and implement computer programs. That is not your fault. It is just the way things are. Even students with an unusually high amount of experience tend not to have been adequately taught how to develop software. A novice's approach is adequate for very small computer programs, but utterly fails for the kinds of software that you will produce in this course.
I have found that it is senseless to teach data structures and algorithms without also covering fundamental methods of software development, since without studying that students are not prepared to solve the programming assignments. Therefore, an important component of this course is how to design software in an organized and disciplined way.
You will need to resolve to put what we cover into practice. Each student has a discipline adoption delay, the number of failures to solve an assignment it takes before the student makes a commitment to using discipline. Students with a short discipline adoption delay usually do well in this course. Those with a long discipline adoption delay can expect to do poorly.
A computer processor works at the machine language level, performing simple instructions one after another. But very few people write software directly in machine language. There is too much detail to keep track of.
Much of the application programming work that you do in other courses or in workplace environments is done in higher level languages, such as Java, that are two levels above machine language. They hide a lot of the details of how computers work from view, making the programmer's task more logical. They cover over some pitfalls. They offer error checking to help you find and fix errors.
Most system programming is done in languages such as C that are just one level above machine language. Some of the uglier details of machine language are taken out of your hands, but the actual nature of the processor and memory are exposed for you to exploit as you see fit. Software for small computers, including for game consoles, is frequently written at this level since it allows more efficient use of time and memory resources.
This course is taught in C++, an extension of C. We will stay mainly in the C subset, using just a few features of C++.
An important component of this course is developing a correct mental model of computers and C++ programs. You will see fundamental ideas of data structures without a lot of machinery between you and the data structures. Knowledge of machines at this level is very helpful even when you are working in languages such as Java.
This is not a course on object-oriented programming, and we will not use the object-oriented features of C++. Object-oriented programming is covered in the course that comes after this one, CSCI 2540.
Different instructors often take different approaches to teaching the same course. Here are some of the guiding principles that I use in this course.
Most programming languages have libraries, collections of tools that ease software construction. For example, Java has an extensive library it calls the Java Application Program Interface, or API. (In fact, Java has more than one API.) C++ has the Standard Template Library. Some instructors concentrate on how to use a library.
For this course, I prefer to take a do-it-yourself approach. We will use a few small libraries, but will not use the Standard Template Library. Here are some of my reasons for this.
If you concentrate on learning how to use a library, you find that the library becomes a crutch. If you need to do something that the library does not provide for, you are at a loss for how to proceed.
Here is a true anecdote to help make the point.
I once had a student
doing some programming work. I asked him to write a
small module to carry out a clearly specified task. A week later,
he came back to me and said that he had scoured the library,
and could not find a tool that performed that task. He
suggested that we wait for the next release of the library,
since it might have the tool that I asked him to create.
Really.
|
Students who learn in a do-it-yourself environment can easily adapt to using a library.
The principles of do-it-yourself computer programming are well established and have a long shelf life. Libraries, on the other hand, are constantly changing. Effort put into learning a library will need to be repeated every few years. Operating systems for small devices such as smart phones and tablet computers currently have APIs that change frequently.
You cannot fully appreciate data structures and algorithms without creating them yourself.
There is a collection of coding standards for this course that everyone is expected to follow in all submitted work. Some of the standards are intended to help you avoid pitfalls that can lead to extra work time. Some of the standards are there to make programs easier to understand without the need to reverse-engineer them, and to make submissions easier for me to grade.
Each assignment is designed to focus on a particular set of competencies. Some of the standards ensure that you do not work around what an assignment is intended to get you to do.
If you fail to follow the coding standards in your submitted work, you will lose points, the amount depending on which standard you violated and on to what extent you violated it.
You are not required to follow the coding standards on quizzes. There is more leniency there.
Everybody makes mistakes. You can be sure that you will make a lot of mistakes writing computer software. Everybody does. I prefer to have an atmosphere where everyone accepts that, and where there is no stigma associated with making a mistake. Just let it wash off you like water off the back of a duck.
The key is, when you make a mistake, try to fix it. Ways to fix mistakes fall under the heading of software development and implementation principles, and we will see several important techniques.
Not all students will be happy with how I teach this course. Some of you have learned a different way of doing things, and will resent me for telling you to do things my way. Some of you will be annoyed when I point out your mistakes.
But I cannot have a separate course philosophy for each student. Therefore, the coding standards apply to all, even to those who don't like them. You will need to learn to follow the instructions for programming assignments, even if you prefer to do something else.
It is crucial for you to read the notes, either before or after each lecture. Just be sure that you keep up with the course. Students who do not read the notes will do poorly in this course. When reading these notes:
But reading the notes is not enough. It is essential that you work the exercises. You can no more learn to write software just by reading about it than you can learn to ride a bicycle by watching movies of other people riding. Students who do not work the exercises in the notes will do poorly in this course.
Repetition is crucial for learning anything well. Go back and review sections that you read earlier. You will get a lot out of a second reading.
What score do you receive on an assignment that does not compile without fatal errors? Answer
What grade do you get if you submit a plagiarized assignment? Answer
What should you do if you get stuck and cannot make progress? Answer
Can you use the C++ Standard Template Library in this course? Answer
Who is required to follow the coding standards? Answer
If you think that you can improve on an assignment, should you do that for extra credit? Answer