1 / 36

CS 240: Data Structures

This class introduces CS.240: Data Structures. Topics covered include course expectations, syllabus overview, recommended resources, grading policies, and communication methods.

johnstevens
Download Presentation

CS 240: Data Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 240: Data Structures Tuesday, May 29th Introduction

  2. Welcome • First, I want to find out some stuff about each of you: • Name, Major, Year • Preferred Email (you are responsible for your binghamton.edu address, but I’ll send things to an alternatve address if you want) • Previous CS, Math, or EECE courses.

  3. Some Group Work • Get in groups, or don’t get in groups • I’ll ask each group for a response • Come up with a few ideas for the following:

  4. Group Work • What do you think this course is about? • What do you want this course to be about? • What do you want to be able to accomplish after this course? • What have you gotten from your previous CS courses (140, 210, 211, 220)? • What are the responsibilities of a student? • What are the responsibilities of an instructor?

  5. Group Work Discussion

  6. Syllabus • This course meets M, T, R from 4-6pm. • My office hours are M, T from 2:00-3:30 in EBN13. Appointments can be made for other times. • My email is: jloew@cs.binghamton.edu • Office phone: 777-7613 (email is preferred) • AIM: delbin1 (I’m not on often so don’t rely on AIM. Let me know you are from class if you decide to use this). • Website: http://bingweb.binghamton.edu/~cs240

  7. Syllabus • Textbook: • “Objects, Abstraction, Data Structures and Design Using C++”, Elliot B. Koffman and Paul A.T. Wolfgang. Wiley 2005. • Available at the school bookstore, Mando Books (not sure about Summer 2008), etc. • An electronic edition is available from wiley.com

  8. Syllabus • Recommended: • For those who want a good C++ resource. • “Absolute C++”, Walter Savitch. Addison-Wesley 2007. • I am not sure if the school bookstore or Mando Books ordered this text. They probably didn’t.

  9. Syllabus • Additional Resources: • Microsoft Academic Alliance: • http://msdn04.e-academy.com/elms/Storefront/Home.aspx?campus=binghamton_watson

  10. Syllabus • Complier: • In this class we use g++ on the Bingsuns machines. • Bingsuns can be accessed from most locations with an internet connection. • The first homework assignment will require you to connect to Bingsuns from an external machine – this isn’t true… but you should make sure you are comfortable with doing this.

  11. Grades • Homework/Labs/Quizzes 24% • Projects 22% • Presentations/Defenses 12% • Exam 1 14% • Exam 2 14% • Final Examination 14%

  12. Academic Honesty • Don’t cheat. I’d prefer to leave it at that. • The syllabus goes into a little more detail.

  13. Attendance • Attendance is required. • Let me know if some problem comes up and we can make arrangements. • If you miss a class, I assume that you caught up on the material on your own. • Generally, there are no makeup exams/quizzes or presentation times. • Makeups will never be identical to the original and can be of any format.

  14. Blackboard • Blackboard will be used to track grades, submit some assignments and post questions (if desired). • Make sure your grades match what is on Blackboard. • A “0” indicates that I did not receive your assignment. It is your responsibility to resolve this within 2 weeks of the assignment being returned to class. • After the 2 week period, grades for an assignment are considered final.

  15. Lab Sections • Lab classes are held in LNG103. • These will reinforce some of the topics we discuss in class and give students a chance to implement ideas and learn some coding constructs.

  16. Communication • Email: jloew@cs.binghamton.edu • Generally, if I don’t respond with 24 hours I didn’t get your email.

  17. Grading Disputes • Regrade request must be made in writing and within 2 weeks of return of the assignment. • Assignments submitted late may be graded more harshly than non-late assignments and are considered differently in the regrading process. • However, assignments should be handed in on time.

  18. Submissions • Hard copies are required for all submissions. These are handed in during class or in the dropbox. • Some submissions will require submission on blackboard, ftp, or other electronic forum. • Coding assignments must be on your H: drive. They may be examined during lab.

  19. Coding Policies • For most of the course, we will not use many of the existing abstractions provided as part of C++. • Most of the assignments can be completed with knowledge of only a handful of coding structures.

  20. Coding • I tend to be very strict when grading code • Even if code works, it can still be wrong! • Although I will grade code very harshly, revisions and resubmission are part of the software process and are expected for the majority of assignments.

  21. Any questions about the syllabus? • I’ll give you a few minutes to discuss with other students if you want.

  22. Introduction to C++ • First, we’ll cover some key differences between C++ and Java

  23. Java Intrepreted Generally portable import C++ Compiled Source may be portable #include

  24. Java (Hello.java) public class Hello { public static void main(String args []) { System.out.println(“Hello!”); } } javac Hello.java java Hello C++ (Hello.cpp) #include<iostream> using namespace std; int main() { cout << “Hello!” <<endl; return 0; } g++ Hello.cpp –o Hello.exe ./Hello.exe Hello World Examples

  25. C++ (Hello.cpp) #include<iostream> using namespace std; int main() { cout << “Hello!” <<endl; return 0; } g++ Hello.cpp –o Hello.exe ./Hello.exe Hello World Examples • C (Hello.c) #include<stdio.h> int main() { printf(“Hello!\n”); return 0; } gcc Hello.c –o Hello.exe ./Hello.exe (g++ will also work) In general, your C code will compile with a C++ compiler.

  26. C++ vs Java • There are other differences that we will talk about as they come up. • It isn’t terribly useful for us to laundry list all the differences. They’ll make sense when we get there.

  27. Functions • In C++, functions do not require a class as a wrapper. int addTwoToInt(int input) { return (input+2); } • Simple enough, it adds 2 to our input:

  28. Includes commonly used C++ components Allows us to use cout instead of std::cout Function prototype. Keeps all the function names in one neat location #include<iostream> using namespace std; int addTwoToInt(int input); int main() { int number = 5; addTwoToInt(number); cout << number << endl; cout << addTwoToInt(number) <<endl; return 0; } int addTwoToInt(int input) { return (input+2); } Entry Point Variable: Number Calls our function Prints: 5 Prints: 7 Exits main(), returns 0 (success) Function Definition Function operation and return statement

  29. Commenting Functions int addTwoToInt(int input) { return (input+2); } • How do we describe a function?

  30. Commenting Functions // Takes in 1 int (input) // Returns int (input + 2) // No side effects - optional if nothing happens // No special conditions - optional if none int addTwoToInt(int input) { return (input+2); }

  31. When should I write a function? • If you ever copy/paste, consider a function. • This is in contrast to what you may have been told in CS140 (copy/paste of a template leads to more efficient programming). • It leads to ugly procedural code. • Functions can also be used to separate code into more managable portions (and reduce side effects).

  32. Procedural Programming • We write functions to “Decompose” a problem. • Many problems are too large to simply write code to solve. • Even if they aren’t too large, procedural programming can lead to code reuse and easier debugging.

  33. We have a list of numbers and want to convert them to binary. How do we decompose this? Repeat until done Get numbers Choose a number Convert to binary

  34. Implementation Repeat until done #include<iostream> using namespace std; int main() { while(areNumbersLeft() == True) { int nextnumber = getnextnumber(); int converted = convertToBinary(nextnumber); } return 0; } Get numbers Choose a number Convert to binary This code won’t work until the functions are made (areNumbersLeft, getnextnumber, convertToBinary). However, it should be clear what this code will ultimately do. Next, we would need to make the functions do what they claim to do!

  35. C printf scanf C++ cout cin Starting Code • C and C++ have some differences in how particular things are handled. We will cover some of these (explicitly) and be expected to know both methods.

  36. First Assignment • Should be online. • Next class we will go over the reading assignment.

More Related