CS 202 Computer Science II

Fall 2019


GENERAL INFORMATION

This is the website for CS 202 Computer Science II offered in Fall 2019 and taught by Jeff Kinne and Gage Golish. This class will be held TWRF 11-11:50am in Root Hall A-017.

Office hours are as follows.

  • Jeff Kinne - MW noon-3pm, TR 9-11am in Root Hall A-140D.
  • Gage Golish - see at the bottom of cs.indstate.edu.

Get to Jeff's code on the server

cd ~jkinne/public_html/cs202-f2019/code
or
cd /u1/junk/cs202-kinne

Click on the links on the left for information about the course.

COURSE ANNOUNCEMENTS

  • Here we'll keep notes on announcements for the course.
    Skip to the latest
  • August 16
    • Basic plan for the semester - (0) getting started with Linux and the CS systems, (1) C and data structures / algorithms in C, (2) C++, (3) more DS and algorithms, (4) some interesting programs.
  • August 20
    • Welcome to class - syllabus, etc.
    • Reading - The C Programming Language - read it all, just all of it. Quiz on keywords and data types, see assignments page QUIZ2. Start looking through, and come with questions tomorrow and Thursday.
    • Linux - HW1 linux (should be no problem for you).
    • C programming bootcamp - HW3.
    • Size of datatypes for gcc on CS systems - do this in class with a program.
  • August 21
    • Reading suggestions - what are people reading (if The C Programming Langauge doesn't work for you)?

      Recommendations - https://www.learncpp.com/, Learn C the Hard Way, https://learnxinyminutes.com/docs/c/ (study guide)

    • HW1... If you had everything correct you have a 5/5 in blackboard. Things to keep in mind... copy hello.c or hello.py. In courseDir.txt put the sizes of the smallest/largest.
    • Note - no class in A-017 at noon, so feel free to stick around to ask questions, work on things, etc.
    • Don't panic! We know for some of you we're starting out quickly. We just want you to work on this outside of class, and we'll adjust as needed.
    • See Study Guide in C Programming Bootcamp
    • See appendices referenced for studying for Quiz 2
    • HW3 - solutions to a few of the problems
  • August 22
    • HW1 - Gage, all 5/5's?
    • Quiz Tuesday - see assignments link. Sample quiz and answers tonight (or tomorrow).
    • Today - some useful things in C - generate random integers, dynamic memory, sorting.
    • Pointers
    • Compiling and running:
      	  gcc program.c -o outputName
      	  ./outputName	
    • HW3 questions? Stuck on any, need hints?
  • August 23
    • Continuing with memory from yesterday. Command-line args. Arrays versus malloc. Pointers. Memory - stack, heap, data, code.
    • Quiz2 - Tuesday
    • HW3 pointers question
    • HW3. Handing in. hwcheck. questions.
    • HW3 - out of how many points?
    • Attendance - remember, login to the computer you are at.
  • August 27
    • Quiz2. Redo maybe on Thursday.
    • HW3 - grades are in, I will allow late work. You need to get at least 8 of the problems this week. HW4 has you checking in at judy.indstate.edu about problems you are working on.
    • HW3 - check your grade in blackboard again, I had an mistake in my grading script.
    • HW3 - to auto-check your program run, be logged in and one directory higher than your HW3 director and run
      	  cd ~/HW3
      	  make -i -k
      	  handin --hwcheck HW3
    • HW3 - note - we will be running a "cheat checker"... (Gage see ~cs202/mossCheck.pl)
    • Note - some code for this class is also kept at /u1/junk/cs202-kinne
    • HW4 - due before class Friday.
    • Working through examples in the code directory - reading strings, command-line args, generating random numbers, reading in integers.
  • August 28
    • Continuing from yesterday...
  • August 29
    • Quiz 2 retake - will be in class tomorrow. It will be very similar. Everyone will take it, and we'll take the max of the two scores. Note - if you had less than 90% you should study so you do well. This class is very much cumulative so if at any point you get behind it becomes likely that...
    • Quiz 2 - make up a cheat sheet (also study it)
    • Recipes/useful things - start keeping a directory of small C programs that do useful things (read a line at a time, read an array of integers, etc.)
    • Tomorrow - new HW assignment, information about the next quiz.
    • Today - command line arguments, memory (again, arrays, pointers, stack versus global versus heap versus code)
  • August 30
    • Maybe - bit operations, hex, octal, etc.
    • Quiz2 retake
    • Gage runs the show
  • Sept 3
    • HW3 - updated grades in blackboard later today.
    • Quiz2 - updated grades in blackboard (Gage - when?)
    • HW5 - Gage is the point on this one... Demo of handin and hw5 correct solution on the assignments page.
    • Quiz6 - coming up, Gage is the point on this one...
    • End of this week - 3 week attendance and estimated letter grade (ask next week if we don't tell you).
    • Converting decimal to binary - note that you can also convert decimal to binary (or any other base) from the 1's bit first. See for example https://www.electronics-tutorials.ws/binary/bin_2.html.
  • Sept 4
    • BD4ISU - paid internship, under-represented, biomedical informatics
    • HW4 - grades in blackboard later today.
    • print_hex - in the code directory. Fix print_hex1. For you to do - modify the correct program so it can do base 36 as well.
    • quiz6 - check the sample quiz, make sure you understand how to do the problems, come up with your code for the questions from question 5 and ask if you can't figure those out...
    • linked lists - remind yourself of the basic idea / pseudocode, and running time, for the operations. Start a cheat sheet for data structures with this info for each data structure we study.
  • Sept 5
    • HW4 - grades in, see notes on the assignments page about turning in late for 100% credit.
    • Guest presentation from TechPoint.
  • Sept 6
    • quiz
  • Sept 10
    • Quiz6 -
    • HW5 -
    • Linked lists
    • Assigned code reading - code/memory/, return value of scanf (what does it mean), ll3.c, ll4.c
    • Recipes - while loop to scanf in ll3.c, for loop to print linked list
    • Programming habits - always check return values (for error, i.e., check return of malloc to make sure not NULL)
    • Programming habits - always check that a pointer is not NULL before dereferencing (with * or ->)
    • Soon - review - binary tree, hash table, sorted and unsorted array, stack, queue
    • Soon - code for those, header file / link / makefile for our data structures
    • Soon - RPN calculator (uses stack)
    • Soon - use for queue
  • Sept 11
    • Finish Gage's linked list, turn RPN into a HW assignment
    • HW7 - due in one week, see assignments
    • Quiz6 - returned
    • HW5 - ??
    • Challenge - Jeff tries to leave a "challenge" question at the end of each lecture. These will not be graded. You should work on them before the next class, and if anyone asks for Jeff's solution he'll do it at the beginning of class.
    • Challenge - implement a stack by using an array to store the data, "push" at the end of the array, and the number of elements currently in the array is where to push/pop next, and use malloc/realloc to allow it to grow as large as needed.
  • Sept 12
    • HW5 - ??
    • Quiz6 - solutions - Gage? Retake?
    • Asymptotic notation / growth of functions - Intro to Algorithms chapter 3 - definition (big O, Omega, Theta, little o, omega), rules of thumb (polynomials - take the highest exponent term, polynomials are greater than polylogs and less than exponentials)
    • Data structures review - lookup, insert, delete for each - pseudocode/idea, running time. Reading - Intro to Algorithms - chapters 10, 11, 12.
    • Quiz6 retake on Tue (Sep 17) - 15 minutes, slightly condensed version
  • Sept 13
    • Data structures review - arrays (sorted, unsorted), linked list, stack, queue, hash table, binary search tree (balanced, unbalanced), heap
    • Challenge - write up code for sorted array, unsorted array in C. Main loop similar to LL where scanf numbers and do inserts, then print the information at the end.
    • Quiz6 retake Tuesday. Gage - model solutions?
  • Sept 17 - no class
  • Sept 18
    • Review - arrays (sorted, unsorted), linked list (and stack, Q), binary search tree.
    • Start code for - hash table
  • Sept 19
    • Quiz retake
    • Hash table - finish code
    • Utility programs - will be in code/utils. For today - randomInts.c
    • Quiz coming up - basic data structures
    • HW coming up - basic data structures.
    • Reading assignment - why not to use floating point values as keys for a hash table - stackoverflow
    • Reading assignment - randomInts.c
  • Sept 20
    • Continuing...
    • Note - first chance at programming assessment in one week
    • Ungraded HW - do the following operations assuming both linear probing and chaining, with hash table of size 9. Insert: 62, 50, 45, 2, 17, 88, 5, 18.
    • Fix HW5 and resubmit, let Gage know, before tomorrow midnight.
    • HW6/7 - due by Sunday 11:59pm, Gage grades on Monday. Please resubmit your assignment to make sure we have it in the "on time" submissions folder.
  • Sept 24
    • HW8 - Contest1, programming assessment. May be added to. Due Oct 2.
    • Programming assessment (and see also /u1/junk/ProgrammingAssessment/) - Quiz9 Friday in class
    • Quiz on the computer - Thursday, programming assessment
    • Recipe - scanning a file one character at a time
    • BST code - Contest1
    • Gage - HW5 solutions video, HW6/7 graded, if HW not handed in put in a 0
  • Sept 25
    • Contest1 - BST code
    • Contest1 - questions?
    • Come back to soon - hash tables
    • Exam1 - when?
  • Sept 26
    • Contest1 - questions?
    • Exam1 - when? Oct 8 and 10.
    • Quiz on the computer - next week.
    • acm_contest - will be worth HW points...
    • BST - made into its own library - let's see, and there will be an assignment
  • Sept 27
    • Assessment - count it out of 4 problems, 4 points.
  • Oct 1
    • Assessment - correct solutions on the board, check your answers, type in your answers for #1, #2, #5, let me know if you think you're code is correct after you try it first.
    • Went over 2's complement algorithm, you should know how to do that now. Try some on your own, check them online.
    • Rest of the bullet points for today - things to keep working on, looking over.
    • functions every citizen should know and also see C standard library (link on the links page, mentioning most important files to check on). If you'd like examples for any, ask and I'll put some up.
    • acm_contest - get at least 4, HW 9, get more than CS 458 and win fabulous prizes
    • HW 10 - BST, work in pairs, model solution not ready yet, won't be due until next week some time.
    • HW5, HW6 - model solutions posted to youtube
  • Oct 2
    • Programming assessment - ??
    • Quiz on data structures - the chart from the board, sometime soon
    • Quiz on functions every ... and C standard library, sometime soon
    • Contest1 and acm_contest - due Tuesday, but get at least one of the contest problems done by the Friday deadline (Friday_13 seems the easiest...)
    • HW10, HW11 - will be assigned a bit later
  • Oct 3
    • Sample exam (and maybe solutions) available by Sunday night or delay the exam
    • Exam on paper - fill in the blank (C keyword, function info [name, return, parameters]), evaluate expression, programming assessment questions, data structures chart and completing code for operations, bases and 2's complement. One page cheat sheet.
    • Exam on computer - programming assessment questions. No internet, you have your account and what we've done in class.
    • Today - files.c from code/recipes. Check options for open and fopen to see the difference. Note that the code for fopen will end up calling open...
  • Oct 8
    • Sample exam (actually, what you need to study) - see in the code directory. On paper exam Oct 10, on computer is Oct 15. Make a good cheat sheet, and also study the information so you know it; speed may matter.
    • Contest1 and acm_contest - questions
    • Next programming assessment - Oct 18 noon.
  • Oct 9
    • Questions on paper exam?
    • Programs you're working on - let's take a look...
  • Oct 10 - paper exam
  • Oct 11
    • Computer exam Tues. Questions on sample?
    • Sample exam as "assignment" over the weekend.
    • Contest1 and acm_contest - last chance due date - Oct 18.
  • Oct 15 - computer exam, Oct 16 - work day
  • Oct 17
    • Programming assessment prep - probably the last time we do this all together
  • Oct 18
    • Programming assessment
  • Oct 22
    • Debugging with gdb. -g flag with gcc. Start with gdb a.out. run command (with command-line parameters works too). Other commands - backtrace (bt), frame (to switch which stack frame looking at [which function among those that are currently not done]), kill, break file:line, step (goes into functions), next (does not go into functions), continue, print (can print variables in scope, also with pointers/arrays). For more, see gdb cheat sheet.
    • Reading assignment - code/memory/*.c
    • Reading assignment - code/utils/*.c
  • Oct 23
    • Exam1 paper - you've got it. #4 and #6 - read the question. You should want to know ALL of the stuff on the exam; none of it optional. Look for some videos.
    • Our bst, ht, ll, stack, q, heap data structures. Versions of these that can be included in other programs and used. A few functions left incomplete for HW.
  • Oct 24
  • Oct 25
    • Example with modified BST - int_example.c in code/data_structures/binary_tree/
    • Delete in BST - pseudocode in bst.h, will be assigned as part of HW42
    • Rebalancing - AVL tree, rebalancing operations - started today, will finish Tuesday
    • HW42 - labeled a few things in bst.h / bst.c that will be part of this. Jeff will do his version first and then email the class when assignment is ready.
  • Oct 29
  • Oct 30
    • HW42 - get started, ask questions. Note - code check when you are finished with each of the numbered steps in the README file.
  • Nov 7
    • HW42 - status? Come checkin with Jeff, see next.
    • Come to Jeff's office hours to do grading for HW42 and check out your code in person. Make sure to handin so we can look at the files. Jeff's available times - Thursday 9:30-1, 2-3; Friday noon-1:30; Monday 11-2:30; Tuesday 8:30-11, 1:30-2:30; Wednesday noon-2:30. Go ahead and keep working on your HW42 until you see me, and handin before you come to my office. Get as much working as you can, and get as many of the answers into the .txt files as possible.
    • acm_contest - status? We really want you to get at least 3 of them... Easiest 2 - interesting, friday13. Next easiest - desks, lab. Note, for sorting - can use qsort, see http://www.cplusplus.com/reference/cstdlib/qsort/
    • 202games - nobody has started. We'll do C++ overview first, Jeff does my game in C++. And in pairs if you want.
  • Nov 12
    • Reminder - come see me about HW42. If you're stuck on something, ask now, and stop by to see Jeff or Gage.
    • C++ - example files are *.cpp in code/recipes/CPP. See the link for cplusplus.com on the links page - look through for what methods are available for string and other builtin types. Note that you can still use any of the C header files and functions. Note that you compile with g++ instead of gcc. Note that you normally name your files .cpp instead of .c. Note that you need to include "using namespace std;" in your file (or prefix everything with std::, or using namespace just the things you're using).
    • Programming assessment - scores from Friday are in blackboard (they don't count for anything, just there as a record). Everyone who got at least 4 passed, you are all set. There was a 3 who was close, should have been okay if stuck around for extra time. Score of 0-1.5 - not really close, need to spend time working on your C programming - see links on the links page, do HW assignments you hadn't finished, do more easy hackerrank problems. Score of 2 - maybe you're going to be okay, but need to improve your C programming as well.
    • Programming assessment - pass it and at least a C for the class.
  • Nov 13
    • C++ - word_counts in CPP, maybe simple 2d maze game in CPP.
    • Reading assignment - code/recipes/CPP - copy into your account, compile, run, make some little changes, etc.
    • Classes next semester - take CS 303, 456, 451 (if it works)
    • Reading assignment - cplusplus.com C++ language tutorial
  • Nov 14
    • Easy cpp HW - next week
    • Graphs and graph algorithms. Vocab / concepts / facts - vertex/node/V, edge/arc/E, degree, connected, directed/undirected, weighted/unweighted,
  • Nov 15
    • Reviewed on the board - AVL rotation, delete. Keep working HW42.
    • Reading assignment - Intro to Algs (3rd edition) 22.1, 22.2, 22.3, 23.1, 23.2, 24.3
    • Tuesday - more in graphs CPP.
    • Wednesday - Jeff's curses in CPP.
    • Coming soon - easy CPP assignment.
  • Nov 19
    • HW42 due 11/25, acm_contest due 12/02
    • Note - we're not going to finish everything we should. Will likely do some supplemental material over winter break (recommended but not required).
    • Today - more in graphs CPP. See cs202-f2017 for example graphs...
    • Note - Friday exam on paper - everything we have done in C / DS up until CPP (CPP not on this exam). Sample exam coming soon...
    • Note - read BFS and DFS in chapter 22 of book.
  • Nov 20
    • Exam2. Topics - code/EXAM/. Sample questions tonight. Review/questions tomorrow.
    • 202games - code/202games/cs20200. To use c++, change gcc to g++ in the Makefiles, change cs202*.c to cs202*.c*
  • Dec 3
    • Exam2 graded, all exam scores rescaled so top grade is 100%. Note that this artificially makes your total percentage grade look higher than it really should be (for many of you). If you got less than 15/30 on exam2 you are not where you need to be. If you got greater than 20/30 you are probably okay, if you got less than 10/30 you are really not where you need to be.
    • Reminder - if you don't pass the programming assessment on your last try, you can get at most a C-, but if you do pass you get at least a C.
    • 202games - Jeff's cs20200 mario project is current in gitlab and also at code/202games/cs20200. It is in C++ and also shows how to do color and some other things. There are also some new examples in code/recipes/CPP. If there is something you want to know how to do in C++ or curses, ask Gage or Jeff and we'll give you a small example showing how to do it.
    • acm_contest - Gage, ready for grading...
    • HW42 - I'll grade it soon.
    • Today - exam2 and 202games
    • Optional assessment HW? You make up example programming assessment problems and solve them, and share the solutions. Yes? How many problems?
    • Programming assessment - last chance for the semester is this Friday 11am-1pm
  • Dec 4
    • recipes/CPP examples
    • 202games - get started...
    • Exam - Thu 10am, Fri 10am. Fri is the exam, Thu is a work day / demo. Exam - everything - similar to Exam2.
  • Dec 5
    • Work on your 202game - get started so you have a problem to fix today.
      	  git config --global core.editor "nano" # emacs or whatever
      	  git pull   # grabs other people's files from your branch
      	  
      	  git add file.whatever # adds the file to be tracked
      	  git commit # logging in the system that your changes should be saved
      	  # note this opens something vim, commands for vim: i for insert, type stuff, ESC, :w to write, :q to quite
      	  git push   # sends the commit'ed changes to the remote server
      	  
    • If you have not passed the programming assessment yet, you should work on assessment practice. There is a new assignment that you can check out - assess_prac2 - which has two problems of each type. You should work on these problems, and this will count as part of your 202games grade.
  • The End
    • Final grades...
      Grades are in for 202games, HW42, Exam3. Anyone who passed the assessment was given at least a C. There are grade notes for HW42, run handin -g HW42.
    • Exam3 - answers are in code/EXAMS
    • Final grades...
      If you are from C to B-, you should keep working on your programming, review the material (in particular the answers to the exams, and data structures information [see links page]), and work on the HW programs again. If you are B/B+ you are okay for now but don't forget anything! Everyone has areas they need to work on, anything you missed in this class is important in some later courses.
    • More, more, more...
      We did not get through everything we needed to. I'll be sending out more programs to work on and additional reading material later this week. Work through these things over break to get ready for later courses.
    • Remember...
      Programming can/should be fun (not always, but at least sometimes). Figuring out the right algorithm and/or analysis/answer to CS problems is interesting and "neat" (at least sometimes). CS is a meritocracy, so the more you put into it the better off you'll be.
  • Coming up
    • suffix tree and/or suffix array - used for string searching, some bioinformatics algorithms
    • String algorithms
    • Performance testing - howto, compare C / C++ / Python / Java / R for some common tasks
Note: course website layout/code/template from Steve Baker. Anything horrible is not his fault.