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

CSCI-UA 102 005 007


Instructor Dr. Anasse Bari


Office Hours


You do not need to schedule an appointment for my office hours you are welcome to stop by during these hours:

11:30am-12:30 every Tuesday 

11:30am-12:30 every Thursday


Final Exam

CSCI-UA 102-005 (7856) Data Structures (Lecture) 5/20/2019, Monday        8:00AM - 9:50AM            60 5th Ave, Rm 150        

CSCI-UA 102-007 (9425) Data Structures (Lecture) 5/16/2019, Thursday       2:00PM - 3:50PM            Bldg:SILV Room:401     

Make sure you attend the exam for your section. Student who will attend the exam that is not of their section will NOT be allowed to take the final.

The final exam is comprehensive. More details will be given to you during the lectures.


CS102 Policies for sections 5 and 7:

Homeworks submitted by email will NOT be accepted and will not be discussed. 

Please do use NYU classes and respect the deadlines. 

Emails with attached homeworks will be automatically ignored; a 0 will be assigned.


Tutoring Hours for CS102 Section 5 and Section 7:


Rule Number One About Tutoring Hours: Please make sure you attend the hours for your section, do NOT attend the hours for other sections. The tutors will NOT serve you if you attend tutoring hours that are not of your section. Please know the section number you are in. Thank you for your collaboration.


102.07 2:00pm to 3:15pm


Tutoring Hours:

Monday  1-3pm George, 406 CIWW
Tuesday 111:15-1:45pm Rakshit, 350 60FifthAve
Thursday  3:30-6pm   Jeff, C15 60FifthAve
Friday  12-3pm   Rakshit, 406 CIWW



102.05 9:30am to 10:45am


Tutoring Hours:

Mondays  3:30-6pm  Sam, 406 CIWW
Tuesday  1-3pm Sam, 406 CIWW
Tuesday 3:30-6pm Jeff, 406 CIWW
Tuesday 5-6pm Sam, 406 CIWW
Wednesday 3:30-6pm  Sam, C15 60FiftAve
Thursday  3-5pm  Veena, 406 CIWW
Friday  11am-2pm  Jeff, 350 60FifthAve


Recitations Office Hours: 


Prof.Nicholas Thomas Greenquist, 10:30am - 11:30am Thursdays, WWH 412


Prof. Daniel Rivera, 10am to 11am, Wednesdays, WWH 412





Welcome to CS102

Read Chapter one from the textbook




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 




Additional Online Resources


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 

Reading: Want to Work at Google or Facebook? Here s What You Need to Know


Chapter One: Introduction to Data Structures




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



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

Differentiating between the procedural programming paradigm and the object-oriented programming paradigm 

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

Additional Resources to Read:


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.


Attachment: Binary Recursion Tree on Finding Global Minimum 


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


TED talk to see: What's the fastest way to alphabetize your bookshelf? - Chand John


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




Chapter Six: Linked Lists


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:

LinkedList (1)

LinkedList (2)


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)





Additional Online Resources


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




Amazon and Google interview questions about data structures: 


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


Practice Exercises and Solutions 


Interview Questions in Java


Online Java Quizzes


Python to Java Guide


Eclipse Tutorial


Debugging Programs in Eclipse


Assignments (the deadlines will be sent to you be email) 


Programming Assignment One


Homework One: University Course Registration System using OOP


Data File


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


Classes, Objects, Inheritance, Polymorphism, Interfaces, Abstract Classes, Method Overriding, File I/O, ArrayLists, Serialization and more on Object-Oriented Paradigm


Deadline: check NYU Classes (submission by email will NOT be accepted) 15% off per day after the deadline (4 days maximum).


Learning Objectives:


Learning how to design and engineer a software solution using the Object-Oriented Programming Paradigm (OOP)

Practicing Abstraction, Encapsulation, Inheritance, Method Overriding, Method overriding and Polymorphism.

Practicing Sorting of Objects

Practicing Abstraction (Abstract Data Types, the ArrayList class, Lists..)

Practicing File/IO in Java

Practicing Serialization and Binary Files in Java


Programming Assignment Two


Homework Two: Recursion, Searching and Sorting Algorithms 


Deadline: check NYU Classes (submission by email will NOT be accepted) 15% off per day after the deadline (4 days maximum).


Learning Objectives:


Learning how to design recursive algorithms

Learning how to derive the running time of algorithms

Learning major sorting and recursive sorting 

Analyzing sorting algorithms running time




Programming Assignment Three 

Homework Four: Serving a Queue of Customers using Queue/Priority Queue implemented as a LinkedList (non-generic) 


Additional Files:

Customer File: 1

Query File: 2

Sample Output: 3


Learning Objectives:


Implementing LinkedLists and Queues 




 Programming Assignment Four