Data Structures

CSI33      D01 (45959)

Monday, Wednesday, 12:00 pm-1:50 pm, room CPH 320
 

 
Date Class Materials HW assignment
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
Solutions: Chapter6-questionsAnswers-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
2) programming exercise: p. 184 / 3


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