Date | Class Materials | HW assignment |
05/17 | Section 14.4 Lecture slides: CSI33-Lecture26.pdf A short (~2mins) but very nice video of depth first search algorithm application: https://www.youtube.com/watch?v=mE_PCK0oFyo |
|
05/15 | Sections 14.1 - 14.3 Lecture slides: CSI33-Lecture25.pdf Dikstra's example: DijkstrasExample.pdf Breadth First Search Demonstration (you tube, ~9 mins): https://www.youtube.com/watch?v=EuwG9nk0VxQ Dijkstra algorithm Demonstration (you tude, ~9 mins): https://www.youtube.com/watch?v=8Ls1RqHCOPw In-class Work: CSI33_Lecture25InClassWork.pdf Solutions: CSI33_Lecture25InClassWorkSols.pdf |
|
05/10 | Sections 13.3-13.5 in C++ Lecture slides: CSI33-Lecture24.pdf programs (in C++): Heap.h, Heap.template, testingHeap.cpp programs (from the book and not, in Python): Heap.py, usingHeap.py |
Suggested exercises (for practice, not for grade): 1) Multiple-Choice questions: p. 481 / 10 2) Short-Answer Questions: p. 481 / 2 3) In-class work |
05/08 |
Section 13.3 in C++ Lecture slides: CSI33-lecture14.pdf programs (in C++): TreeNode.h, TreeNode.cpp AVLTree.h AVLTree.cpp TestAVLTree.cpp programs (from the book, in Python): TreeNode.py, AVLTree.py, helpForAVL.py in-class work (with solutions): CSI33-AVL-In-Class-Practice.pdf, avl_handout-CSVirginiaEDU.pdf |
Suggested exercises (for practice, not for grade): 1)AVL trees (Short Answer questions): page 481 / 4-11, 2) Look through the AVL code in Python and lecture slides - understand how the rotations are done. Finish up the AVL.py code. Comments: you can use the following code for testing/seeing what is happenning(just add it to your program) helpForAVL.py 3) Look through the AVL code in C++ thoroughly |
05/03 | Section 7.5 in C++ Lecture slides: CSI33-Lecture13.pdf programs (in C++): TreeNode.h, TreeNode.cpp, usingTreeNode.cpp, BST.h, BST.cpp, usingBST - updated on 05/03 around 9 pm programs (from the book and not, in Python): TreeNode.py, BST.py, usingBST.py Useful links: BST delete node: http://www.algolist.net/Data_structures/Binary_search_tree/Removal Insertion and deletion (6 mins video): https://www.youtube.com/watch?v=wcIRPqTR3Kc Comment: deletion procedure here follows a different strategy: right subtree, leftmost element. In-class work: see lecture slides |
HW21 (due date: Friday, 05/12) - last HW assignment programming exercise: define the delete operation for BST trees in our C++ code (use Python's code) |
05/01 | Sections 12.1-13.2 Lecture slides: CSI33-Lecture23.pdf - slides updated on 05/02 programs (from the book and not): maximum.cpp, vec1.cpp, vec2.cpp, vec3.cpp, Stack.h, Stack.template, test_Stack.cpp In-class Work: 1) Implement a template minimum function and test it on int and double type values. Solution: minimumInClassWork.cpp 2) Implement a Queue using templates along with the code to test it. This is a suggested HW assignment. Solution: Queue.h, Queue.template, test_Queue.cpp 3) Implement BST using templates along with the code to test it. |
Suggested exercises (for practice, not for grade): 1) True-False questions: p. 440 / 1, 2, 5 2) Multiple-Choice questions: p. 440-441 / 1, 2, 4 3) Programming exercise: p. 442 / 2 Solution: Queue.h, Queue.template, test_Queue.cpp |
04/26 | Sections 11.1 - 11.4 Lecture slides: CSI33-Lecture22.pdf programs (from the book and not): ListNode.h, LList.h, LList.cpp, testLList.cpp - updated code of LList.cpp and testLList.cpp, in the latest more of test code is added. In-class Work: see lecture slides. |
HW20 (due date: Wednesday, 05/10) - due date changed 1) Programming exercise: p. 424 / 2 here is the code to check that your program works correctly: Chapter11-testLList2.cpp Suggested exercises (for practice, not for grade): 1) True-False questions: p. 422 / 1, 2, 5 2) Multiple-Choice questions: p. 423 / 1, 2, 4 3) Short-Answer questions: p. 424 / 1, 2 Solutions: Chapter11questionsAnswers.pdf |
04/24 | Sections 10.4 - 10.5 Lecture slides: CSI33-Lecture21.pdf programs (from the book): List.h, List.cpp, testList.cpp, testList1.cpp, testListp.cpp> Check out this one as well: unsigned.cpp In-class work: see lecture slides Solution (only for cin): List2.h, List2.cpp, testList2.cpp |
HW19 (due date: Friday, 05/05) - due date changed |
04/20 | Sections 10.1 - 10.3 Lecture slides: CSI33-Lecture20.pdf In-class work: see lecture slides Answers: 1) we do have a memory leak, see the picture 2) program: CSI33Lecture20InClassWork.cpp |
HW18 (due date: Wednesday, 05/03) 1) Short-Answer questions: p. 399 /5, 6 Suggested exercises (for practice, not for grade): 1) True-False questions: p. 396 / 3, 4, 2) Multiple-Choice questions: p. 397 / 1, 2, 3, 5 Solutions: Chapter10-questionsAnswers_part1.pdf |
04/19 | Sections 9.4 - 9.5 Lecture slides: CSI33-Lecture19.pdf programs (from the book): mainv1.cpp, Rationalv1.cpp, Rationalv1.h; Rationalv2.h, Rationalv2.cpp, mainv2.cpp; Rationalv3.h, Rationalv3.cpp, mainv3.cpp; Card.h, Card.cpp, using_Card.cpp in-class work solution: to be posted |
HW17 (due date: Friday, 04/28) 1) Programming Exercise: p. 352 / 3 Use this code to test your program: Rational_testing.cpp 2) Short Answer questions: page 351/4 Answers to some of the True/False and Multiple Choice questions from Chapter 9: Chapter9-questionsAnswers-Part1.pdf |
04/10-04/18 | Extra practice for C++ programming:
|
|
04/05 | Sections 8.17, 9.1-9.3 Here is a link to C-string vs C++ string: http://cs.stmarys.ca/~porter/csc/ref/c_cpp_strings.html Lecture slides: CSI33-Lecture18.pdf programs (from the book): Rational.cpp, Rational.h, MainProg.cpp, RationalOldStyle.cpp, MainProg.cpp, stringex.cpp, getline.cpp, readfile.cpp |
HW16 (due date: Wednesday, 04/26) 1) Read chapter 8 and go through the True/False and Multiple choice questions, 2) Read sections 9.1-9.3, and go through the True/False questions 1-13, and multiple choice Questions 1-6, 3) Work on the HW 15 and if you have time, play more with C++. |
04/03 | Sections 8.12-8.17 Lecture slides: CSI33-Lecture17.pdf programs (from the book): conversions.cpp, conversions.h, conversions2.h, macro.cpp, reference.cpp, scope.cpp, switchWithAssert.cpp, switch.cpp, switch2.cpp, switch3.cpp, selection.cpp In-class work: see the lecture slides (last three slides) You can work on a Final Project to raise your grade. Here is a suggested list of projects that might interest you: CSI33FinalProjects.pdf Projects 8 and 9 are excluded from the list. |
HW15 (due date: Wednesday, 04/26) 1) Read about macros on page 302 and see example (macro.cpp) 2) read sections 8.17.2 and 8.17.3 3) programming exercise: page 317/ 8-9 (do it in one program) test code and header for your programs: searches.h, test_searches.cpp Suggested exercises: (for practice, not for grade): 1) look through the True/False and Multiple choice questions 2) Use our Python code (mergeSort.py) and write the definition of Merge Sort. Use the following files to put Selection sort (selection.cpp) and Merge sort into: sort.h, sort.cpp, and then use these ones to test them: test_sort.cpp, test_sort2.cpp. |
03/29 | Sections 8.8-8.11 Lecture slides:CSI33-lecture16.pdf, CSI33-Lecture17.pdf (up to sorting slide, excluding) programs (from the book): grades.cpp, if1.cpp, if2.cpp, if3.cpp, typeConvs.cpp, loopExample1.cpp, buffer.cpp, str1.cpp Here is a link to C-string vs C++ string: http://cs.stmarys.ca/~porter/csc/ref/c_cpp_strings.html In-class work: see the last slide of the lecture slides Solution: CSI33-Day16-InClassWork2.cpp You can work on a Final Project to raise your grade. Here is a suggested list of projects that might interest you: CSI33FinalProjects.pdf |
HW14 (due date: Friday, 04/07) - changed to Monday, 04/10 1) programming exercises: page 316/ 1, 2, 3, 4, 6 for programming exercise 2, here is the link to the slides that give the algorithm for it (starting from slide 53): CSI30-Ch3Section1part2.pdf |
03/27 | C++ is coming to our classroom! Sections 8.1-8.7 Lecture slides: CSI33-lecture15.pdf programs (from the book): ctof.cpp, swap.cpp, increment.cpp, uninit.cpp In-class work: see lecture slides Solutions: FtoC.cpp, CSI33-Day15-InClassWork.cpp Software: 1) We have Microsoft Visual Studio installed on all computers at CP 320. Get Community Edition, package: Desktop development with C++ (free): https://www.visualstudio.com/downloads/ 2) You can also use Dev-C++ (for Windows platform only, free) http://orwelldevcpp.blogspot.com/ - look under Downloads, pick The setup which includes TDM-GCC 4.8.1 (32bit and 64bit)(47MB): http://sourceforge.net/projects/orwelldevcpp/files/Setup%20Releases/Dev-Cpp%205.10%20TDM-GCC%204.8.1%20Setup.exe/download - The portable version with compiler: The portable version which includes TDM-GCC 4.8.1 (32bit and 64bit) (34MB): http://sourceforge.net/projects/orwelldevcpp/files/Portable%20Releases/Dev-Cpp%205.10%20TDM-GCC%204.8.1%20Portable.7z/download 3) Code Blocks (for all platforms, free): http://www.codeblocks.org/downloads/26 4) JetBrains CLion It is free, but you will have to apply for it with your school e-mail. The confirmation will be sent to your e-mail immediately. Then you can proceede to the download page and get CLion. https://www.jetbrains.com/student/ |
HW13 (due date: Monday, 04/03) 1) Read the beginning of Section 8.2 (pages 256-257) |
03/23 | Sections 7.1-7.4 Lecture slides: CSI33-Lecture12.pdf programs (from the book): TreeNode.py In-class work: see lecture slides Answers: CSI33Lecture12pics.pdf |
HW12 (due date: Wednesday, 03/29) - changed to Sunday, 04/02 1) Short-Answer questions: p. 248 / 6 Suggested exercises (not for grade): 1) True-False questions: p. 245 / 1-5 2) Multiple-Choice questions: p. 246 / 2, 3 Solutions: Chapter7-questionsAnswers.pdf |
03/20 | Midterm Exam | |
03/15 | Sections 6.4-6.6 Lecture slides: CSI33-Lecture11.pdf You can watch a video on Merge Sort here: http://en.wikipedia.org/wiki/Merge_sort programs (from the book): fib.py, selectionSort.py, mergeSort.py, hanoi.py In-class assignment: see lecture slides Midterm Exam will be on Monday, 03/20. More information can be found in Midterm and Final Exams |
HW11 (due date: Saturday, 03/25) - changed to Wednesday, 03/29 1) programming exercise: pp. 215-216 / 5 |
03/13 | Sections 6.1-6.3 Lecture slides: CSI33-Lecture10.pdf programs (from the book): fact.py, reverse.py, anagrams.py, power.py, bsearch.py In-class work: see lecture slides Solutions/answers: maxRec.py Midterm Exam will be on Monday, 03/20. More information can be found in Midterm and Final Exams |
HW10 (due date: Wednesday, 03/22) - changed to Monday, 03/27 1) Short-Answer questions: p. 214 / 5 2) programming exercise: p. 215 / 1 Suggested exercises: (for practice, not for grade): 1) What list is returned by anagrams("word")? 2) True-False questions: p. 212 / 1, 2, 3, 6 3) Multiple-Choice questions: p. 213 / 1, 4, 5, 6 4) Trace recPower(4,8) and and figure out exactly how many multiplications it does. 5) Short Answer questions: p.214 / 1 Solutions: Chapter6Answers_part1.pdf |
03/08 | Sections 5.3-5.5 Lecture slides: CSI33-lecture09.pdf programs (from the book): MyQueue.py, palindrome.py, simulation.py, CheckerSim.py, In-class work: write an event-driven version of the checker simulation. Solution: simulationEventDriven.py, CheckerSimEventDriven.py |
HW9 (due date: Friday, 03/17) 1) programming exercise: p. 184 / 4 |
03/06 | Sections 5.1-5.2 Lecture slides: CSI33-lecture08.pdf programs (from the book): Stack.py, parensBalance2.py In-class assignment: see lectures slides. Solutions/answers: In-classWorkAnswers.pdf, Stackunittesting.py Check out these useful videos: Infix to Postifx: https://www.youtube.com/watch?v=rA0x7b4YiMI Infix to Prefix: https://www.youtube.com/watch?v=fUxnb5eTRS0 |
HW8 (due date: Monday, 03/13) 1) Short-Answer questions: p. 183 / 1 Answer: Chapter5-questionsAnswers-part2.pdf 2) programming exercise: p. 184 / 3 (use Stack to evaluate the post-fix expression as shown in lecuture slides) Suggested exercises: 1) True-False questions: p. 181 / 1-4 2) Multiple-Choice questions: p. 182 / 1-5 Solutions: Chapter5-questionsAnswers-part1.pdf |
03/01 | Sections 4.4 - 4.5, 4.7 Lecture slides: CSI33-lecture07.pdf Programs: ListNode.py, LList.py In-class work: see the last slide in the lecture slides Solutions: Section4_6InClassWork.py, Section4_6InClassWorkGenerator.py |
HW7 (due date: Friday, 03/10) 1) programming exercises: p. 152 / 1, 3 (do both in one file, LList.py) Suggested exercises: 1) True-False questions: p. 148 / 1, 2, 4, 5 2) Multiple-Choice questions: p. 149 / 1-4 3) take a look at two versions of __copy__ method for LList class's implementation on page 132. Solutions/answers: Chapter4-questionsAnswersSuggestedProblems.pdf |
02/27 | Sections 4.2-4.3 Lecture slides: CSI33-lecture06.pdf Programs: Section4_2example.py, ListNode.py For in-class work: Sections4_1-4_3InClassWork.py, Section4_2example2.py In-class work: see lecture slides (the last two slides) and use this file: problems1-2 Answers: problems 1-2: ListNode_classwork.py, Sections4_1-4_3InClassWorkProblems1-2.py; problems 3-4: In-classWorkProblems3_4.pdf |
HW6 (due date: Monday, 03/06) 1) Short-Answer questions: p. 151 / 2 Answers: Chapter4-questionsAnswers.pdf 2) Programming assignment: Let's think about doubly-linked lists. Define a class ListNode2, with three attributes: item, leftL, and rightL. Left link points to the previous node in the list, right link points to the next node in the list. You can also add the display method to this class (like we did it in class for the ListNode class). Then test your class. For example, create a linked list of 5 values: 34, 1, 23, 7, and 10. Display it. Then insert new value, say 8 between 34 and 1 (this time you will have to take care of links pointing to the previous and next node), display the resulting list. Then delete and element, update the links and display the new list. Use this draft: ListNode2_forStudents.py |
02/22 | Sections 3.5-3.6 Lecture slides: CSI33-lecture05.pdf Here is a link to time-complexity (aka "Big O" or "Big Oh") of various operations in current CPython: https://wiki.python.org/moin/TimeComplexity |
HW5 (due date: Wednesday, 03/01) Short-answer questions: p.102 / 3 Answer: Chapter3-questionsAnswers-part2.pdf Suggested exercises (not for grade, but highly recommended): 1) True-False questions: p. 100 / 8, 12 2) Multiple choice questions: p. 101 / 1, 3, 4, 5, 6, 8 3) programming exercise: p. 104 / 9 See suggested specification with some code here: Chapter3-prog9SolitaireSpecs.py, a simpler version: Chapter3-prog9SolitaireSpecs-easy.py Solutions: Chapter3-questionsAnswers-part1.pdf, Solitaire.py, Chapter3-prog9SolitaireStats.py |
02/15 | Sections 3.1-3.4 Lecture slides: CSI33-lecture04.pdf (updated on 02/24) HW1 discussion: SelectionSortAnalysis On this page you can find the link to the compressed file with all the codes from the book: http://www.fbeedle.com/content/data-structures-and-algorithms-using-python-and-c more programs (from the book): Card.py, Deck.py, Hand.py, TestDeck.py, TestCards.py If you want to find out how to play Bridge: rules: http://www.acbl.org/learn_page/how-to-play-bridge/ video: https://www.youtube.com/watch?v=Tyd7KlsRYO4 another video: https://www.youtube.com/watch?v=9yzS_26fICk In-class work: see lecture slides (last few slides) Solutions: in-classWork.py There will be no classes on Monday, Februrary 20th (President's Day) |
HW4 (due date: Wednesday, 02/22) 1) Finish implementing the program discussed in class (in-class work, second assignment). comment: note that at this level you should define classes (for example, for player, for scoring and so forth) where appropriate, also don't forget documentation (both inner comments that start with # and docstrings)! 2) Programming Exercises: p 103 / 1, 2, 3 (don't forget to test all the operations, send the tests with your HW submission) - all of these exercises should be implemented in one file Deck.py Suggested exercises (not for grade, but highly recommended): 1) True-False questions: p. 100 / 2, 3, 6 2) Short-answer questions: p.102 / 1, 2 Solutions: Chapter3-questionsAnswers-part1.pdf |
02/13 | No classes (Lincoln's birthday) | |
02/08 | Sections 2.1-2.3, and 2.6 from the book. Lecture slides: CSI33-lecture03.pdf Programs: cardADT.py, test_cardADT.py, Card-spec.py, Card.py, testCard.py, unitTestingCard.py In-class work: start working on the HW assignment There will be no classes on Monday, Februrary 13th (Lincoln's Birthday), and Wednesday 02/15 will run on Monday's schedule. |
HW3 (due date: Wednesday, 02/15) Write unit tests to test the methods suit, suitName and rankNameof Card class See the Chapter2-unitTestingCardHW.py |
02/06 | class was cancelled | |
02/01 | Section 1.3 Algorithm Analysis Lecture slides: CSI33-lecture02.pdf (updated on 02/02) Additional materials: BinarySearchIllustrated.pdf (updated on 02/02) In-class work: lecture02InClassPractice.pdf Solutions: lecture02InClassPracticeSols.pdf |
HW2
(due date: Wednesday, 02/08): 1) Short-answer questions: p. 36 / 8 Solution: Chapter1ShortAnswerQuestions.pdf 2) Write a program that has both Linear Search and Binary Search algorithms implemented defined as two seprate functions. Run each of the algorithms on the list of integers from 0 to 999999 and time them on three different numbers to search for: 10, 499999, and 999999. At the end your program should print the results. Here is a draft/skeleton of the program: hwAssignment-twoSearches.py 3) Programming Exercises: p. 37-38 / 3, 9 Programming exercise 3 asks you to implement Selection Sort algorithm. See my comments here: here and video (about 10 mins) presenting visualization of Selection Sort: https://www.youtube.com/watch?v=f8hXR_Hvybo Reminder: don't forget to put specification for each of the functions you are defining as well as use internal comments (that start with #) Suggested exercises: (not for grade, but highly recommended): 1) True/False questions: p. 33 / 4-6, 9, 10 2) Multiple Choice questions: pp.34-35 / 1-6, 10 Solutions: Chapter1solsTFMConly.pdf |
01/30 | Sections 1.1, 1.2 Lecture slides: CSI33-lecture01.pdf In-class work: lecture01-handout.pdf Solutions: lecture01-handoutSols.pdf Announcements: 1) First two chapters of the book are available through e-reserves: http://bcc-libweb.bcc.cuny.edu/electronic-course-reserves/ Choose CSI33 from the drop-down menu 2) annual CUNY MATH CONTEST The contest begins on-line at 9:00 A.M. on Monday, February 15, 2016 more info: http://math.cisdd.org/ |
HW1
(due date: Monday, 02/06): 1) read Sections 1.1-1.2 2) read about docstring conventions at http://www.python.org/dev/peps/pep-0257/ 3) get the book |