Data Structures

CSI33      D01 (43426)

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

 
Date Class Materials HW assignment
Week 15


Reminders:
1) The due date for the Final Project is May 23rd;
2) Our Final Exam will be on Wednesday, May23rd (same place, same time). Check our more on Midterm and Final Exams
 
05/17 Review  
05/16 Sections 14.1 - 14.4

Lecture slides: CSI33-lecture27_part1.pdf, CSI33-lecture27_part2.pdf
Dikstra's example: DijkstrasExample.pdf
Breadth First Search implementation in C++: BFS.h, BFS.cpp, usingBFS.cpp, input1.txt

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

A short (~2mins) but very nice video of depth first search algorithm application: https://www.youtube.com/watch?v=mE_PCK0oFyo

In-class Work: CSI33_Lecture27InClassWork.pdf
Solutions: CSI33_Lecture27InClassWorkSols.pdf
 
05/14 Section 13.3 in C++

Lecture slides: CSI33-lecture26.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) Multiple-Choice questions: p. 481 / 10
2) Short-Answer Questions: p. 481 / 2
3) AVL trees (Short Answer questions): page 481 / 4-11,
Answers: Chapter13-AVL-answers.pdf
4) 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
5) Look through the AVL code in C++ thoroughly
 
Week 14 
05/09 Section 7.5 in C++

Lecture slides: CSI33-Lecture25.pdf

programs (in C++):
TreeNode.h, TreeNode.cpp, usingTreeNode.cpp,
BST.h, BST.cpp, usingBST

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
Suggested exercise (for practice, not for grade):

define the delete operation for BST trees in our C++ code (use Python's code)
05/07 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
 
In-class Work: see lecture slides, files to use: PQueue_ideas.py
Answers/solutions: PQueue.py
Suggested exercises (for practice, not for grade):

0) Look through the hash examples in Section 13.5
1) True/False questions: p. 478 / 1, 2
2) Short-Answer Questions: pp. 479 - 480/ 1, 2, 4, 5, 8, 9
3) In-class work
Answers: Chapter13-answers.pdf
Week 13 
05/02 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
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
Answers: Chapter12questionsAnswers.pdf
04/30 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.
Solutions:
2) ListNode2.h, LList2.h, LList2.cpp, testLList2.cpp
3) to be posted
HW20 (due date: Monday, 05/7) - last HW assignment

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
Week 12 
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: Wednesday, 05/02)

1) Programming exercise: p. 400 / 4
see and use: mystring.h, mystring_draft.cpp, string_using.cpp

reccomendations:
1) Start with definitions of constructor, destructor, operator+=(const char c), resize and cout functions.
2) Then add operator[], search/find, and reverse definitions.
3) Conclude with definitions of copy constructor, assignment operator= (both of these operators can use private method copy), and operator+=(const String& str)input method is already defined in the files provided.

 
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: Monday, 04/30)

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
Week 11 
04/18 Sections 9.4 - 9.5

Quiz 7 (based on Sections 8.17, 9.1 - 9.3)

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: (with counter_ place in the private section):
Card-InClassWork.h, Card-InClassWork.cpp, using_Card2.cpp
 
HW17 (due date: Wednesday, 04/25)

1) Programming Exercise: p. 352 / 3
Use this code to test your program: Rational_testing.cpp

Suggested exercises:

1) Short Answer questions: page 351/4

Answers to some of the True/False and Multiple Choice questions from Chapter 9: Chapter9-questionsAnswers.pdf

2) Define a Complex Number class using rectangular form of complex numbers, i.e. any complex number is r+mi, where r and m are real numbers and i is imaginary unit). Recall that i2 = -1.

The class should have +,-,and * binary operations defined.

Here are examples of operations:
(2+3i)+(9-7i) = 11-4i
(2+3i)-(9-7i) = -7+10i
(2+3i)*(9-7i) = 18-14i+27i-21i2 = 18+21+13i = 39 + 13i 
04/16 Sections 8.17, 9.1-9.3

Quiz 6 (based on Sections 8.1 - 8.17)

Reference manual to C++ string class: http://www.cplusplus.com/reference/string/string/

comparison of C-strings and C++ strings: 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;
stringex.cpp, getline.cpp, readfile.cpp

HW16 (due date: Monday, 04/23)

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 (not for submission),
3) Write a program that reads a collections of values (decimal numbers) from the input file and
- finds the smallest value,
- find the greatest value,
- finds the average of all values,
- finds the average of all positive values,
- finds the average of all negatice values,
- reports how many zeros,
- reports how many positive values are in the file,
- reports how many negative values are in the file,
- sorts them and stores the sorted collection of values in an output file.

All the information (except for the sorted collection) should be displayed on the screen. Each item above (finding smallest value,etc.) should be defined as a function.
Week 10

Keep summary of the data structures we explored so far with the run-time efficiency of common operations!!!


Extra 10 points towards the Midterm Exam Grade: work on the other version of the Midterm Exam. Write all solutions and answers neatly. Make sure you understand everything. Send the two programs to my e-mail. Submit everything on Monday, April 9th (no late submissions!). You can either scan your work and send it my way or submit a paper version. If you submit a paper version I will return it to you only on May 23rd (the day of the Final Exam), so make sure you keep a copy.

Thursday, May 17th will be running on Wednesday schedule.
 
04/11 runs on Friday schedule


 
 
04/09 Sections 8.12-8.17

Lecture slides: CSI33-Lecture17.pdf (starting from headers)

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)
Solution: functions.h, inClassWork17.cpp
 
HW15 (due date: Monday, 04/16)
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 of Chapter 8

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.

 
Week 9

Keep summary of the data structures we explored so far with the run-time efficiency of common operations!!!

Final Projects list and instructions: CSI33FinalProjects_Spring2018.pdf
Doodle poll (where you state which project you are working on):https://doodle.com/poll/kbmzk9rzgfh2k8cz

Please note that only one person can work on a project. If the project is alreadt taken, chose another one.

In Visual Studio to keep console window "not closed" follow these instructions:
right click your project name,
go to Properties page,
expand Configuration Properties -> Linker -> System,
click on the SubSystem - you will see dropdown menu on the right,
select Console (/SUBSYSTEM:CONSOLE) in dropdown.

By default, the Empty project does not specify it.

The Midterm Grade is composed of Homeworks and Midterm Exam only (the quizzes will be counted only at the end of the semester).

Extra 10 points towards the Midterm Exam Grade: work on the other version of the Midterm Exam. Write all solutions and answers neatly. Make sure you understand everything. Send the two programs to my e-mail. Submit everything on Monday, April 9th (no late submissions!). You can either scan your work and send it my way or submit a paper version. If you submit a paper version I will return it to you only on May 23rd (the day of the Final Exam), so make sure you keep a copy.

 
03/28 Sections 8.8-8.11

Lecture slides:CSI33-lecture16.pdf,
CSI33-Lecture17.pdf (up to headers, 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 
HW14 (due date: Monday, 04/09)
2) 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/26 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/
 
HW14 (due date: Monday, 04/09)
1) Read the beginning of Section 8.2 (pages 256-257)
Week 8

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

03/21 we will go over the Midterm Exam - the college was closed  
03/19 Midterm Exam  
Week 7

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

Midterm Exam will be on Monday, March 19th. More details can be found in Midterm in Final Exams.

Keep summary of the data structures we explored so far with the run-time efficiency of common operations!!!

On Wednesday, 03/21 we will start working with C++  
03/14 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, 03/26)
1) programming exercises:
p. 248 / 2, 3, 5
Test code you can use for these problems: TestCodeForHWAssignment.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/12 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: Monday, 03/19)
no programming assignment

Suggested exercises (not for grade):
1) True-False questions: p. 245 / 1-5
2) Multiple-Choice questions: p. 246 / 2, 3
3) Short-Answer questions: p. 248 / 6

Solutions: Chapter7-questionsAnswers.pdf
Week 6

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

Midterm Exam will be on Monday, March 19th. More details can be found in Midterm in Final Exams.

Keep summary of the data structures we explored so far with the run-time efficiency of common operations!!!
 
03/07 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: Friday, 03/16)

programming exercise: pp. 215-216 / 5
 
03/05 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
HW10 (due date: Wednesday, 03/14)

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, 5

Solutions: Chapter6Answers_part1.pdf, Chapter6Answers_part2.pdf
Week 5

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

Begin to summarize the data structures we explored so far with the run-time efficiency of common operations!!!
 
02/28 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: Thursday, 03/08)

programming exercise: p. 184 / 4
02/26 Quiz 3

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/05)
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
3) Short-Answer questions: p. 183 / 1

Answers/Solutions: Chapter5-questionsAnswers-part1.pdf, Chapter5-questionsAnswers-part2.pdf
Week 4

Here is the list of grades for homeworks and quizzes: https://goo.gl/8LVt8U
 
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 an element, say 7, 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
Comments:
* 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

* In programming exercise 9 you are not to use the built-in set type.

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