120 likes | 294 Views
CS50. Section: Problem Set 3. Jordan Jozwiak. Announcements. Don’t forget about Walkthrough, CS50 Shorts, cs50.net/discuss, office hours when attempting psets Pset0 and Pset1 feedback and grades are out
E N D
CS50 Section: Problem Set 3 Jordan Jozwiak
Announcements • Don’t forget about Walkthrough, CS50 Shorts, cs50.net/discuss, office hours when attempting psets • Pset0 and Pset1 feedback and grades are out • Access section materials from this year and last year at http://cloud.cs50.net/~jjozwiak/ • Pset2 feedback and grades will returned by Thursday at the latest
Introductions (again) • “Important stuff” • Name • Year • House • Concentration • Actually important stuff (pick two) • Favorite TV show • Favorite band • Favorite flavor of ice cream • Best and/or worst rumor you’ve heard about CS50
This Week • Note on grading • Pset2 feedback • Sample Pset2 Solutions • Section of Questions • Using GDB • Runtime • Searching • Sorting • Different algorithms
A Note on Grading • Normalized between TFs • Professor Malan stresses that the focus should be on improvement! • Grades should be considered as • 1 Poor • 2 Fair • 3 Average • 4 Good • 5 Excellent • Discussion at end of semester to look at holistic grade
Pset2 – Feedback • Don’t use trailing comments; // they are annoying • Return values for main • Return 0 at end of main (Stylistically correct, just know that it is implicit) • Use different return values for different errors (Return 1, Return 2, etc.) • Program header at top of files (file name, your name, brief description of functionality) • Variable names should be descriptive, but not lengthy • Include white space before comments
Pset2 – Feedback continued… • ASCII values • ‘a’, ‘z’, ‘A’, ‘Z’ are like useful variable names • 97, 65, etc. seem like arbitrary numbers (if there weren’t the above notation then you would want to use magic numbers!) • #define constants • #define ALPHABET_LENGTH 26 • Much more useful than seeing the number 26 in the middle of code • If statements that return from main don’t need else statements after them
Pset2 – Feedback continued… • Always think about the possible cases and how we can be exhaustive without performing unnecessary checks • argc != 2 • Possible characters • Uppercase • Lowercase • Everything else
Sample Pset2 Solutions • What’s good? • Could anything be better? • Other questions?
Section of Questions • Shorts… GDB, Bubble Sort, etc. • What does GDB let you do? • Why does binary search require that an array be sorted? • Why is bubble sort in ? • Why is insertion sort • What’s the worst-case running time of merge sort? • How does selection sort work?
Coding time!!! • Use CS50 Spaces • http://apps.cs50.net/spaces • Work with partners (but actually)! • Our section’s website (for extra resources, maybe) • http://cloud.cs50.net/~jjozwiak/
On your way out… • Check out cheat sheets online! • Feedback • How comfortable are you with the material? • How is the pace of section? • Any other questions, suggestions or concerns?