Data Structures

CSI33      D01 (43426)

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

 
02/21 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/02)
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/20 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: Wednesday, 02/28)

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


Suggested exercises
(not for grade, but highly recommended):
1) Short-Answer questions: p. 151 / 2
Answers: Chapter4-questionsAnswers.pdf
Week 3

Note that on Monday, February 19th College Closed - President's day,
Tuesday, February 20th runs on Monday schedule


Here is the list of grades for homeworks and quizzes: https://goo.gl/8LVt8U
 
02/14 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/21)
programming exercise: p. 104 / 9
See suggested specification with some code here:
Chapter3-prog9SolitaireSpecs.py,
a simpler version: Chapter3-prog9SolitaireSpecs-easy.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) Short-answer questions: p.102 / 3

Solutions: Chapter3-questionsAnswers-part1.pdf, Chapter3-questionsAnswers-part2.pdf
02/12 No classes (Lincoln's birthday)

Here is the list of grades for homeworks and quizzes: https://goo.gl/8LVt8U
 
Week 2

Note that on Monday, February 12th College Closed - Lincoln's Birthday

Here is the list of grades for homeworks and quizzes: https://goo.gl/8LVt8U
 
02/07 Sections 3.1-3.4

Lecture slides: CSI33-lecture04.pdf
HW2 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): CardADT.py, 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 
HW4 (due date: Wednesday, 02/14)

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/05 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
HW3 (due date: Monday, 02/12)

Write unit tests to test the methods suit, suitName and rankNameof Card class

See the Chapter2-unitTestingCardHW.py

Week 1
 
01/31 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/07):

1) True/False questions: p. 33 / 4-6, 9, 10 - not for grade
2) Multiple Choice questions: pp.34-35 / 1-6, 10 - not for grade

Solutions: Chapter1solsTFMConly.pdf

3) Short-answer questions: p. 36 / 8 - not for grade
Solution: Chapter1ShortAnswerQuestions.pdf

4) 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

5) 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 to use internal comments (that start with #)
01/29 Sections 1.1, 1.2

Lecture slides: CSI33-lecture01.pdf

In-class work: lecture01-handout.pdf
Solutions: lecture01-handoutSols.pdf

Announcements:
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

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