Date | Class Materials | HW assignment |
05/16 | 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/11 | Sections 14.1 - 14.3 Lecture slides: CSI33-Lecture25.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/09 | Sections 13.3-13.5 Lecture slides: CSI33-Lecture24.pdf programs (from the book and not): Heap.py, usingHeap.py, HashLetter.py, test_HashLetter.py, HashTable.py, test_HashTable.py, HashTable2.py, test_HashTable2.p |
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/04 | Sections 12.1-13.2 Lecture slides: CSI33-Lecture23.pdf 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 |
05/02 | Sections 11.1 - 11.4 Lecture slides: CSI33-Lecture22.pdf programs (from the book and not): ListNode.h, LList.h, LList.cpp, testLList.cpp In-class Work: see lecture slides. Dear All, please note that there are only three weeks left till the last day of classes (Wednesday, May 18th) On Wednesday, May 18th you are to present your final project. |
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 4) Programming exercise: p. 424 / 2 here is the code to check that your program works correctly: Chapter11-testLList2.cpp Solution: Chapter11-prog2-ListNode.h, Chapter11-prog2-LList.h, Chapter11-prog2-LList.cpp |
04/22 - 04/29 |
Happy Spring Break! |
|
04/20 | Sections 10.4 - 10.5 Lecture slides: CSI33-Lecture21.pdf programs (from the book): List.h, List.cpp, testList.cpp In-class work: see lecture slides Solution: |
HW20 (due date: Monday, 05/09) - last HW assignment, due date updated! 1) Programming exercise: p. 400 / 4 |
04/18 | 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 |
HW19 (due date: Friday, 05/06) - due date updated! 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.pdf |
04/13 | Sections 9.3 - 9.5 Lecture slides: CSI33-Lecture18.pdf (File Input and Output) CSI33-Lecture19.pdf programs (from the book): getline.cpp, readfile.cpp, 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 |
HW18 (due date: Friday, 04/22) 1) Programming Exercise: p. 352 / 3 2)Short Answer questions: page 351/4 |
04/11 | Sections 8.17, 9.1-9.2 Here is a link to C-string vs C++ string: http://cs.stmarys.ca/~porter/csc/ref/c_cpp_strings.html Lecture slides: CSI33-Lecture17.pdf (starting from sorting slide), CSI33-Lecture18.pdf (up to C++ stings, including) programs (from the book): switchWithAssert.cpp, switch.cpp, switch2.cpp, switch3.cpp, Rational.cpp, Rational.h, MainProg.cpp, RationalOldStyle.cpp, MainProg.cpp, stringex.cpp Time to choose your Final Project, if you didn't do so already! |
HW17 (due date: Wednesday, 04/20) 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 test code for your programs: 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. |
04/06 | Sections 8.11-8.17 Lecture slides: CSI33-lecture16.pdf, CSI33-Lecture17.pdf (up to sorting slide, excluding) programs (from the book): buffer.cpp, str1.cpp, conversions.cpp, conversions.h, conversions2.h, macro.cpp, reference.cpp, scope.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 Time to choose your Final Project, if you didn't do so already! |
HW16 (due date: Sunday, 04/17) 1) programming exercise: page 316/ 6 Solution: Chapter8-prog6.h, Chapter8-prog6-interestF.cpp, Chapter8-prog6.cpp |
04/04 | C++ is coming to our classroom! Sections 8.1-8.10 Lecture slides: CSI33-lecture15.pdf, CSI33-lecture16.pdf (up to loops, including) programs (from the book): ctof.cpp, swap.cpp, grades.cpp, if1.cpp, if2.cpp, if3.cpp, increment.cpp, uninit.cpp, typeConvs.cpp, loopExample1.cpp In-class work: see the lecture slides and In-Class-Practice.pdf (AVL trees again) Solutions: In-Class-PracticeSols.pdf, FtoC.cpp, CSI33-Day15-InClassWork.cpp. Software (updated): Dev-C++, Windows 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 Code Blocks (for all platforms): http://www.codeblocks.org/downloads/26 |
HW15 (due date: Wednesday, 04/13) 1) Read the beginning of Section 8.2 (pages 256-257), 2) programming exercises: page 316/ 1, 2, 3, 4 for programming exercise 2, here is the link to the slides that give the algorithm for it (starting from slide 53): CSI30-Ch3Section1part2.pdf Solutions: Chapter8-prog1.cpp, Chapter8-prog2.cpp, Chapter8-prog2Improved.cpp, Chapter8-prog3.cpp, Chapter8-prog4.cpp |
03/30 |
Section 13.3 Lecture slides: CSI33-lecture14.pdf, avl_handout-CSVirginiaEDU.pdf programs (from the book): TreeNode.py, AVLTree.py, helpForAVL.py Solutions to in-class work: CSI33-lecture14InClassWork.pdf |
HW14 (due date: Friday, 04/08) 1)AVL trees (Short Answer questions): page 481 / 4-11, Solutions: Chapter13-AVL-answers.pdf 2) Look through the AVL code 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 Solution: AVLTree-completeImproved.py |
03/28 | Section 7.5 Lecture slides: CSI33-Lecture13.pdf programs (from the book): TreeNode.py, BST.py other programs: 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 Solutions:CSI33Leture13InClassWorkSols.pdf, InClassWorkDay13.py |
HW13 (due date: Monday, 04/04) 1) programming exercises: p. 248 / 2, 3, 5 Test code you can use for these problems: TestCodeForHWAssignment.py Solution: BSTenhanced.py, BSTenhanced-using.py 2) Write unit tests for class BST to test insert_rec and find method, by doing the following: Insert the following elements, one by one into a tree: 7, 3, 8, 2, 5, 9, then by using BST's method asList compare the produced by that method list with list [2,3,5,7,8,9] - this is one unit test for insert_rec method. To test the find method: create the same BST as above, and find 8, 2, 9, and 5; compare the result with the numbers themselves. Then try to find 11, 1, and 4 and compare the result of each search with None. Suggested exercises (not for grade): 1) Short Answer questions: p. 248 / 2, 3, 4 Solutions: Chapter7-questionsAnswers.pdf |
03/16 | Midterm Exam | |
03/16 | Class is cancelled | |
03/14 | 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: Thursday, 03/24) 1) Short-Answer questions: p. 248 / 6 Solutions: Chapter7-questionsAnswers.pdf 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/09 | 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 |
HW11 (due date: Saturday, 03/19) 2) programming exercise: pp. 215-216 / 5 Solution: Chapter6-prog5.py |
03/07 | 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/21. More information can be found in Midterm and Final Exams |
HW10 (due date: Wednesday, 03/16) 1) Short-Answer questions: p. 214 / 5 Solution: Chapter6-questionsAnswers.pdf 2) programming exercise: p. 215 / 1 Solution: chapter6prog1.py 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 Solutions: Chapter6-questionsAnswers-part1.pdf |
03/02 | 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: Wednesday, 03/09 - changed to Sunday, 03/13) 1) programming exercise: p. 184 / 4 Solutions: Chapter5-prog4.py |
02/29 | 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/07 - changed to Wednesday, 03/09) 1) Short-Answer questions: p. 183 / 1 2) programming exercise: p. 184 / 3 Solutions: Chapter5-questionsAnswers-part2.pdf, Chapter5-prog3.py Suggested exercises: 1) True-False questions: p. 181 / 1-4 2) Multiple-Choice questions: p. 182 / 1-5 Solutions: Chapter5-questionsAnswers-part1.pdf |
02/24 | 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/04) 1) programming exercises: p. 152 / 1, 3 Solutions: Chapter4-prog1_3LList.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-questionsAnswers.pdf |
02/22 | Sections 4.2-4.3 Lecture slides: CSI33-lecture06.pdf Programs: Section4_2example.py, Section4_2example2.py, ListNode.py In-class work: see lecture slides (the last two slides) Solutions: |
HW6 (due date: Monday, 02/29 - changed to Wednesday, 03/02) 1) Short-Answer questions: p. 151 / 2 Solutions: Chapter4-questionsAnswers.pdf (see the last one) 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. |
02/17 | 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, 02/24) Short-answer questions: p.102 / 3 Solution: Chapter3-questionsAnswers-part2.pdf, Chapter3-ShortAnswer3.py 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/08 | Sections 3.1-3.4 Lecture slides: CSI33-lecture04.pdf 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 (updated code), 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 |
HW4 (due date: Sunday, 02/21 - changed to Sunday, 02/28) 1) Finish implementing the program discussed in class (in-class work, second assignment). Solution: Card.py, Deck.py, Chapter3_game.py, Chapter3-gameRun.py (this is the one to run) 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 Solution: Chapter3-progs1-3DeckModification.py, Chapter3-progs1-3DeckModification2.py (a better version) 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/08 | Sections 2.1-2.3, and 2.6 from the book. Lecture slides: CSI33-lecture03.pdf Programs: cardADT.py, ctest_cardADT.py, Card-spec.py, Card.py, testCard.py, unitTestingCard.py In-class work: start working on the HW assignment |
HW3 (due date: Monday, 02/15) Write unit tests to test the functions/methods suit, suitName and rankName for Card.py Solutions: Chapter1-unitTestingCard.py |
02/03 | Section 1.3 Algorithm Analysis Lecture slides: CSI33-lecture02.pdf Additional materials: BinarySearchIllustrated.pdf In-class work: lecture02InClassPractice.pdf Solutions: lecture02InClassPracticeSols.pdf |
HW2
(due date: Wednesday, 02/10): 1) Short-answer questions: p. 36 / 8 Solutions: 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 Solution: Chapter1-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 #) Solutions: Chapter1-SelectionSort.py, Chapter1-prg3-SelectionSortAnalysis.pdf, Chapter1-prog9-sqeezer.py 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 |
02/01 | 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: Wednesday, 02/03), given at lecture 1: 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 |