CSC 1052 Data Structures and Algorithms II

Fall 2014, Tuesday and Thursday, 6:00 - 7:50 pm

Room: Mendel Hall G86

**Office Hours:**

T Th 10:30 AM -12:00 PM and by appointment

**Course Description:**

This is the second course introduction to problem analysis, algorithm design, and the implementation of algorithms in an object-oriented high-level language. It is intended for computer science majors, computer engineers, and other students with a significant interest in programming and computing. The Java programming language is used in this course. A portion of the course will be dedicated to GUI and Graphic design.
Topics that we will cover include Object-oriented design; inheritance, interfaces, polymorphism; problem analysis; recursion; abstract data types; dynamically linked structures; linear data structures: stacks, queues, lists, vectors; sorting and searching; event-driven programming; graphical user interfaces.

**Course Schedule**

Date | Class Summary | Examples and Code | Homework |

8/26/2014 | Went over the syllabus and course expectations. Discussed IDEs. Began the review of Java. Java template, system.out.println, compiler. | Read Chapters 1 -5 in Java Programing from the ground up. | |

8/28/2014 | We discussed primitive data types. Also went over variable declarations, assignments, operators, operands, the boolean truth table. Strings were introduced as the first object type. String memory and assignment. String methods like toUppercase() and concat(). Strings are immutable. Example programmed using, As I was going to St.Ives nursery rhyme. Conditionals, if, else, else if reviewed and switch statements introduced. Scanners were implemented, for nextInt(), nextBoolean(), next().. nextLine() etc. Rated R movie program was written. | StIves R movie | Read Chapters 6 -8 in Java Programing from the ground up. Lab 1 Due on Sept. 4th. |

9/2/2014 | Discussed the return clause, loops: for loops, while loops, do while loops. Defined what is an object, a class, methods, fields, inheritance, polymorphism. Defined our own Student class, added fields, methods. Talked about different constructors, discussed the "this" keyword, and the "static" keyword. Built a new class Gingerbread. | Gingerbread Example | Read Chapters 1.4-1.6 in Object Oriented Data Structures. |

9/4/2014 | Discussed the toString method and how every class is a subclass of Object. Overriding methods (parent-child) Overloading (same class). Introduced arrays. Length field of arrays, Length() method of Strings. Demonstrated how to create a multidimensional array. Began the discussion of Array Lists. | Array List | Read Chapters 2.1 & 2.5 in Object Oriented Data Structures. Lab 2 due on 9/9 at midnight. |

9/9/2014 | Introduced the TA for the class, Ms.Neha Karing. She will be the primary person involved with grading. Any questions about the class can be sent to both Neha or myself. Talked about array lists and the benefits and problems associated with them. Introduced linked lists and the listnode class. Introduced recursive datatypes where something is defined in terms of itself. Compared linked lists to Array lists in terms of Big O notation. | Read Chapters 1.6-1.7 and 2.6 in Object Oriented Data Structures. | |

9/11/2014 | Returned Lab 1 and Lab 2 grades. Defined constants using the final keyword. Discussed problems with Linked list including maintaining the front of the list and declaring an empty list. Introduced a new list structure to hold the head and size. Introduced the keyword private so that you aren't corrupting data and can change implementations. | ATM List Node Wawa | Read Chapters 2.7, 2.8 and 1.3 in Object Oriented Data Structures. |

9/16/2014 | Workshop day. We worked on Lab 3. | Lab 3 due on 9/18. | |

9/18/2014 | Defined what it means for two objects to be equal. 4 types of equality. reference equality, shallow equality, structural equality, logical equality. Override the equals method. Talked about inheritance, and extends keyword. 3 ways a subclass can modify a superclass, new fields, new methods, override. Introduced the protected keyword. | InheritanceInheritance Solution Equality | Lab 3 due at midnight. |

9/23/2014 | Discussed how inheritance effects constructors. Introduce the super keyword. Problem: what happens if you don't have a zero argument super constructor? Discussed insertFront method for lists and how you can avoid copy and pasting code when your override using the super.insertFront method. Discussed the override keyword. Introduced dynamic method lookup aka dynamic binding. Two different types, variable static type and variable dynamic type. Use instanceof to find dynamic type. Worked on an example in class with Cars and Lamborghini classes. | CompareTo Fix example | Read chapt 12, 13 in Java programming from the ground up. |

9/25/2014 | Introduced abstract classes and interfaces. Concrete classes must implement all of the inherited abstract methods. Java interfaces are like abstract classes but cannot implement any methods, and can only have final static constants. Classes can implement as many interfaces as they want. Discussed the compareTo method from Comparable interface. | Abstract class and interface CompareTo | Project 1 extension. Due on Oct. 2nd midnight. |

9/30/2014 | Discussed project 1. We worked on an in class ungraded assignment taking visual representation of code and programming it out. | Visual PDF code | Project 1 due Thurs at midnight |

10/2/2014 | Discussed Generics in Java. Also went over a real world example of an Array list and critiqued the code. | Generics More generics | Project 1 due at midnight. |

10/7/2014 | Midterm Review session | Midterm on 10/9 | |

10/9/2014 | Midterm | ||

10/21/2014 | We discussed packages in Java and how packages follow a directory structure. Packages use the package keyword. To utilize packages, use the import keyword. We discussed the stack ADT including the functions, push, pop, and top (peek). | Using Packages Zip file of edu | Lab 4 due on 10/23 midnight. Read chapters 3.1-3.3 |

10/23/2014 | We discussed the program calling stack and the heap. Stack stores all local variables including method parameters and the heap stores every object including arrays and class variables. Introduced Exceptions and how to create your own exceptions. Discussed the difference between unchecked and checked exceptions. Example programs created using pop and exceptions. | ArrayStack example using exceptions and pop | Lab 4 due tonight at midnight. Read chapters 3.4-3.7 |

10/28/2014 | Recursion...recursive definitions, base case, recursive algorithms. A recursive algorithm can be defined as the base case and a smaller version of itself. We discussed three recursive problems, factorial, fibonacci, and towers of hanoi. | Project 2 assigned. See here for the template code. Read chapters 4.1-4-3 | |

10/30/2014 | Recursion Continued. We discussed the anagram recursion problem and went over a list implementation of the stack structure. Began a discussion on a new ADT, the queue. The queue is a FIFO structure with multiple implementations including the fixed-front vs floating front design. | Read chapters 5.1-5.3. | |

11/4/2014 | Queue implementations | Queue In class Lab Solution to inclass lab | Lab 5 due 11/6 midnight Dictionary file for lab 5 Read chapter 5.6. |

11/6/2014 | Binary search. Discussed the concept of searching through a sorted list. Went over two impelmentations of binary search, the iterative method and the recursive method. Discussed that binary search is O(log N) whereas linear search is O(N). | Binary search implementation, iterative and recursive | Read chapter 6.6. |

11/11/2014 | Doubly linked lists and their implementaion. Began an introduction to trees, their definitions, and performed a high level overview of several tree traversal methods, including preorder, postorder, and inorder for binary trees. | Read chapter 7.2 and 8.1. | |

11/13/2014 | Began our discussion on sorting. Introduced selection sort and its implementation. Discussed the complexity of selection sort as O(N^2). | Selection sort implementation | Project 2 due on 11/20. Read chapter 10.1 and 10.2. |

11/18/2014 | Discussed bubble sort and insertion sort. Both bubblesort and insertion sort are O(n^2) algorithms. | Example of bubble sort | Lab 6 assigned. Due 11/25 at midnight. |

11/20/2014 | Discussion of Mergesort and Quicksort. Merge sort cuts the array in half, sorts the left, sorts the right, and merges the two sorted halves into one sorted array. Quicksort picks a pivot, creates two lists, puts all the items less than the pivot into list 1, puts all the items greater than the pivot into list 2. Pivot does not go into any list. Recursively sort list 1, list 2 and finally concatenate, list 1, pivot, and list2. | Project 2 due, Read chapter 10.4 | |

11/25/2014 | Implementation discussion of both Mergesort and Quicksort. | Example of merge sort Example of quick sort | Lab 6 due. |

12/2/2014 | Discussion on Hashing. | Lab 7 assigned (and extra credit). Due 12/7 at midnight. | |

12/4/2014 | Hashing Implementation and example. | Hash table *fix* Solution | |

12/9/2014 | Class tutorial video screening day! | Final review topics Sample question1 Sample question 1 solution Sample question 2 Sample question 2 solution | |

12/11/2014 | Review Session | Sample question 3 Sample question 3 solution Sample question 4 Sample question 4 solution |