﻿

New York University

Courant Institute of Mathematical Sciences

Department of Computer Science

CS102 Data Structures

Topics, Agenda, Syllabus and Learning Objectives

Course Name CS102 Data Structures

Instructor

Prof. Anasse Bari

Course Description

The subject of this course is data structures and algorithms. A data structure is an arrangement of data in a computer s memory (or sometimes in a disk). In this course, you will learn ways to structure and arrange data in computer s memory that includes arrays, linked lists, stacks, trees, hashtables, and graphs. Algorithms manipulate that data in these structures in various ways, such as searching for a data element and sorting a set of data elements. In this class you will learn several concepts including how organize data elements, how to delete, insert, edit and search for a data element in a specific data structure and how to sort a set of data elements. You will also learn the differences between different data structures and when to use the right ones to solve problems.

An engineer is constantly solving problems. You will be introduced in this class to practical problems to solve using data structures such as utilizing data structures such as linked-lists, trees and arrays to implement a course registration tool, storing and sorting courses and students information data, modeling social network data using a graph data structure, and applying sorting and graph algorithms to analyze social network data (e.g. potential online community detection)

The programming language adopted in this class is Java, at the beginning of the semester you will have a review of the object oriented programming paradigm and some of its features such as inheritance, abstraction, encapsulation and polymorphism.

Course Syllabus

Course Notes

Assignments

# Class Notes

Chapter Zero: Motivation in Learning Data Structures

In class brief discussion around programming, data structures, data science, big data and the job market

Chapter One: Introduction to Data Structures

Objectives

Defining Data in the Context of Data Structures

Defining the term Algorithm in the Context of Data Structures

Defining the Concept of Data Structures

Outlining Examples of Data Structures

Defining the Need for Data Structures

Learning the basics of Algorithms Design

Learning how to Express Algorithms in Pseudo-code

Practicing Developing Algorithms in Pseudo-code

Chapter Two: Review of the Object-Oriented Programming Paradigm

Sample code needed for HW1 on Simple File I/O and Serialization in Java

Sample Code discussed in class:

Inheritance Example

CompareTo Example

Sorting Objects Example

AbstractClasses

For Interfaces Coding Example see Practice Two

For Polymorphism Examples see Chapter Two notes on the Instrument, Drum, Horn Examples

Objectives (Review of 101s Part on OOP)

Introducing the motivation behind the creation of the object-oriented paradigm

Learning the concept of the class, object (state, behavior and identity), and abstraction

The benefits of using the object-oriented paradigm

Introducing object, classes, constructors, getters, setters, member variables... by designing a phone book directory using the Object-Oriented Programming

Introducing immutable objects and classes

Learning the concept of variable scope, the this references

Introducing abstraction and encapsulation and object composition

Designing a stack class

Learning how to design a class and designing wrapper class for primitive data types

Introducing BigInteger and BigDecimal Classes

Introducing the concepts of encapsulation and inheritance

Learning the super keyword, superclass methods and data fields

Introducing the concept of polymorphism

Learning how to use interfaces and abstract classes in Java

Introducing the comparable java interface

Introducing casting and instance of

Understanding when to use an interface or an abstract class

Readings: Chapter One from the Book

Tutorial: OOP by Oracle

What is Object Oriented Programming? By Andrew Virnuls

Chapter Three: Recursion

Chapter Five from the textbook is an assigned reading for this chapter.

Additional Reading: Introduction to Recursion, Eric Roberts (from page 176 to 184)

Defining recursion

Understanding the motivation behind recursion

Introducing recursion as a problem-solving tool

Learning the key principles behind recursion

Understanding the distinction between recursion and iterative based solutions

Learning recursion trough examples

Introducing the stack data structure as a support data structure for recursive calls

Understanding and applying recursive principles with binary recursion

Chapter Four: Algorithm Analysis and Big-O Notation

Learning how to apply the proper analytical frameworks in examining the running time of algorithms

Defining algorithm analysis

Understanding the role of primitive operators

Understand Big-O notation and time complexity concepts

Chapter Five: Sorting and Searching Algorithms

Reviewing linear search and binary search

Introducing the big picture: the importance of sorting algorithms and their practical applications

Learning about major sorting algorithms (bubble sort, selection sort, insertion sort, merge sort and quick sort)

Practicing binary recursion through recursive sorting

Analyzing the running time of sorting algorithms using recurrence relations

Linked List Part II: Postfix, Infix, Queues and Stacks

Important take home practice exercise (no need to submit it): Write a program to convert a infix notation into postfix notation (you can follow the algorithm discussed in class and mentioned in the Linked Lists Part II), also consider going the brackets problem in the notes using a Stack.

Source code discussed in class and highly recommended to implement for your own review:

--

Generic types based Queue implemented as LinkedList

Notice that the implementation of the generic LinkedList LinkedList<node> and its implementation along with the iterator class implementation are mentioned in the slides form chapter 6.

More on Lists from the source Oracle

Chapter Seven: Arrays and Array Lists (comparison to LinkedList) discussed in class

Chapter Eight: Trees

A Quick Introduction to Graphs (A tree is a special case of a Graph)

Definition of Trees

Rooted Trees

Binary Trees

Binary Search Trees

Sample Source Code

Recursive Pseudo-code on Trees

Chapter Nine: Hash Tables

Sample Source Code (1)

Sample Source Code (2)

Chapter Ten: Graphs

Sample Source Code (1)

Chapter Eleven: The Choice of the Right Data Structure for the Right Problem (Handout distributed in class)

Sample interview questions that are mainly based on algorithms and data structures:

GeekforGeeks

Career Cup

Important Online Sources:

Java Oracle Tutorial

What is Java? A Brief History about Java

Top 25 Most Frequently Asked Interview Core Java Interview Questions and Answers

Interview Questions in Java

Online Java Quizzes

Python to Java Guide

Eclipse Tutorial

Debugging Programs in Eclipse