CSCI 136: Fundamentals of Computer Science II. Keith Vertanen Museum

Similar documents
CSCI 136: Fundamentals of Computer Science II. Keith Vertanen Museum 102 h8p://ka<e.mtech.edu/classes/csci136

Fundamentals of Computer Science II

Recursion CSCI 136: Fundamentals of Computer Science II Keith Vertanen Copyright 2011

Recursion. Overview. Mathematical induction. Hello recursion. Recursion. Example applications. Goal: Compute factorial N! = 1 * 2 * 3...

Recursion. Fundamentals of Computer Science

Announcements. 1. Forms to return today after class:

COMP-202: Foundations of Programming. Lecture 26: Review; Wrap-Up Jackie Cheung, Winter 2016

Introduction to Programming System Design CSCI 455x (4 Units)

Implemen'ng abstract data types

Introduction to Data Structures

Implemen'ng abstract data types. CSCI 135: Fundamentals of Computer Science Keith Vertanen

Michele Van Dyne Museum 204B CSCI 136: Fundamentals of Computer Science II, Spring

Stacks and queues. CSCI 135: Fundamentals of Computer Science Keith Vertanen.

AP Computer Science Unit 1. Programs

Abstract Data Types and Java Generics. Fundamentals of Computer Science

Intensive Introduction to Computer Science. Course Overview Programming in Scratch

CSCI 201L Written Exam #2. 10% of course grade

CSci 5103 Operating Systems. Jon Weissman. Administrivia

last time in cs recitations. computer commands. today s topics.

COMP-202: Foundations of Programming. Lecture 26: Image Manipulation; Wrap-Up Jackie Cheung, Winter 2015

A foundation for programming. Classes and objects. Overview. Java primitive types. Primitive types Creating your own data types

CSCI 136 Data Structures & Advanced Programming. Fall 2018 Instructors Bill Lenhart & Bill Jannen

4/16/2012. Data Compression. Exhaustive search, backtracking, object-oriented Queens. Check out from SVN: Queens Huffman-Bailey.

Equality for Abstract Data Types

CompSci 101 Introduction to Computer Science

CS 455 Midterm Exam 2 Fall 2015 [Bono] Nov. 10, 2015

CS 211: Recursion. Chris Kauffman. Week 13-1

The life and death of objects, sta2cs. CSCI 136: Fundamentals of Computer Science II Keith Vertanen

You will not be tested on JUnit or the Eclipse debugger. The exam does not cover interfaces.

About this exam review

You must bring your ID to the exam.

CSC 172 Data Structures and Algorithms. Fall 2017 TuTh 3:25 pm 4:40 pm Aug 30- Dec 22 Hoyt Auditorium

CS 231 Data Structures and Algorithms, Fall 2016

Object Oriented Programming and Design in Java. Session 2 Instructor: Bert Huang

CSCI-1200 Data Structures Fall 2017 Lecture 7 Order Notation & Basic Recursion

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

Stacks and Queues. Fundamentals of Computer Science.

Hi everyone. I hope everyone had a good Fourth of July. Today we're going to be covering graph search. Now, whenever we bring up graph algorithms, we

Lecture 15: Algorithms. AP Computer Science Principles

COMP110 Jump Around. Go ahead and get today s code in Eclipse as shown on next few slides. Kris Jordan

public class Test { public static int i = 0;

CSCI 135 Exam #0 Fundamentals of Computer Science I Fall 2012

Enjoy a Python Cookie Half a logo per person (blue or yellow python)! CompSci 101 Introduction to Computer Science. More Announcements.

CompSci 101 Introduction to Computer Science

(Refer Slide Time: 02.06)

Searching for Information. A Simple Method for Searching. Simple Searching. Class #21: Searching/Sorting I

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 02 Lecture - 45 Memoization

CS/ENGRD 2110 Object-Oriented Programming and Data Structures Spring 2012 Thorsten Joachims

Computer Science 210: Data Structures

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 2: SEP. 8TH INSTRUCTOR: JIAYIN WANG

CS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style

Midterm Exam 2 CS 455, Spring 2015

APCS Semester #1 Final Exam Practice Problems

Read & Download (PDF Kindle) Data Structures And Other Objects Using Java (4th Edition)

Who am I? I m a python developer who has been working on OpenStack since I currently work for Aptira, who do OpenStack, SDN, and orchestration

CS 110 Practice Final Exam originally from Winter, Instructions: closed books, closed notes, open minds, 3 hour time limit.

CS 2223 B15 Term. Homework 1 (100 pts.)

Announcements. Course syllabus Tutorial/lab signup form (due 4pm today) Lecture 1 notes Homework 1 Initial assessment

CMSC 132: Object-Oriented Programming II. Administrivia

COMP 202 Java in one week

THREADS & CONCURRENCY

Conditionals, Loops, and Style

Prelim 1. CS2110, October 2, 2014, 5:30 PM Extra Total Question TrueFalse Multiple Object Oriented

The Java Type System (continued)

(Refer Slide Time: 01:00)

Out for Shopping-Understanding Linear Data Structures English

CS61BL. Lecture 1: Welcome to CS61BL! Intro to Java and OOP Testing Error-handling

Fun facts about recursion

Total Score /15 /20 /30 /10 /5 /20 Grader

(Refer Slide Time: 00:01:30)

Exam 2. Programming I (CPCS 202) Instructor: M. G. Abbas Malik. Total Marks: 40 Obtained Marks:

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2014

CS 101 Fall 2005 Midterm 2 Name: ID:

ASSIGNMENT 5 Objects, Files, and a Music Player

Final CSE 131B Spring 2004

CISC 181 Lab 2 (100 pts) Due: March 7 at midnight (This is a two-week lab)

COMP-202: Foundations of Programming. Lecture 13: Recursion Sandeep Manjanna, Summer 2015

CSCI 135 Exam #1 Fundamentals of Computer Science I Fall 2012

Math 3012 Combinatorial Optimization Worksheet

Linked Lists. private int num; // payload for the node private Node next; // pointer to the next node in the list }

More on inheritance CSCI 136: Fundamentals of Computer Science II Keith Vertanen Copyright 2014

Welcome to! 4DN4! Advanced Internet Communications"

Spring % of course grade

Announcements. PS 3 is due Thursday, 10/6. Midterm Exam 1: 10/14 (Fri), 9:00am-10:53am

Topics for CSCI 151 Final Exam Wednesday, May 10

Lecture 1: CSE 373. Data Structures and Algorithms

Administrivia. Last modified: Fri Aug 25 10:59: CS61B: Lecture #2 1

PROGRAMMING FUNDAMENTALS

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

CS 111: Programming Fundamentals II

Lecture 1: Welcome! CSE 373: Data Structures and Algorithms CSE WI - KASEY CHAMPION 1

Computer Science II Data Structures

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute

CS Data Structures Mr. Bredemeier Traveling Salesperson Problem

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

Lecture 2: Variables & Assignments

ASSIGNMENT 5 Objects, Files, and More Garage Management

CSCI 136 Written Exam #1 Fundamentals of Computer Science II Spring 2012

Midterm 1 : Correction. Friday, Feb. 23.

VE281 Data Structures and Algorithms. Introduction and Asymptotic Algorithm Analysis

Transcription:

CSCI 136: Fundamentals of Computer Science II Keith Vertanen Museum 102 496-4385 kvertanen@mtech.edu http://katie.mtech.edu/classes/csci136 CSCI 136: Fundamentals of Computer Science II Keith Vertanen Copyright 2011

Overview Course details People Resources Assessment Course topics 2

People Keith Vertanen Museum 102 496-4385 kvertanen@mtech.edu Office hours: Mon 3:00-4:00p Wed 2:00-3:00p Fri 3:30-4:30p Tyler Lee Usually milling around Museum lab trlee@mtech.edu Lab TA hours: TBD 3

Eclipse IDE On lab machines Java 1.6 1.7 not supported Development tools Try and avoid standard input Makes Tyler grumpy We should learn to use the debugger Command line DOS (Windows) Unix (katie) http://cs.mtech.edu/main/index.php/current-students/server-registration 4

Textbook Resources We'll finish Head First Java Chapters 12-18 Laptop buddy program I'm going to try integrating computer activities during (most) lectures Work in pairs Hopefully wireless will work 5

Assignments Assessment A 90% - 100% Exam 1 15% B 80% - 89% Exam 2 15% C 70% - 59% Exam 3 15% D 60% - 69% Programming assignments 55% F 0% - 59% Staff discretion (participation and extra-credit) ±?% Due 10PM on stated day, 2 hour grace period (<= 11:59pm) 4 free late days, 0 if late and no free days left Late days tied to student even if pair programming Individual 1 st half, optional pair programming 2 nd half Now out of 30 points Exams during scheduled 3-hour lab period Written portion and/or computer portion 6

Where we've been We covered most of the Java language & various class APIs primitive data types boolean expressions if-else statements switch-case for-loop enhanced for-loop while-loop do-while loop arrays, 1D, 2D static methods instance variables instance methods try-catch enumerations Math String ArrayList Double Integer PrintWriter File Scanner 7

1: Data structures Course topics How we store and organize data in our programs "I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships." -Linus Torvalds, creator of Linux Opens up the types of programs we can build Not everything works if shoved in an array! 8

Data structures Set Queue Stack Linked list Tree Graph Hash table private class Node { private int num; private Node next; } 9

2: Algorithms Course topics Steps we take to solve a problem Embodies the cleverness to solve problem correctly and efficiently Smart algorithm + right data structure Makes the seemingly impossible possible (but still can't do everything) 10

Travelling salesman Travelling salesman problem (TSP) Locations of a bunch of cities Find shortest possible tour visiting each city exactly once 1000 cities optimal tour 11

SW24978 - Sweden Computation Log Instance Created: July 29, 2001 Number of Cities: 24,978 Optimal Value: 855,597 Solution Method: Concorde, CPlex 6.5 LP Solver, LKH Solution Time: 84.8 years, Intel Xeon 2.8 GHz http://www.tsp.gatech.edu/sweden/index.html 12

Travelling salesman Travelling salesman problem (TSP) Finding optimal tour is easy Try all possible combinations Exponential in number of cities This takes an enormous amount of time! Can we find optimal tour faster? Most people think the answer is no No one has proved it 13

Approximate solution TSP algorithm 1 Data structure = linked list Makes it quick to insert next city anywhere in the list Algorithm = add city into list next to closest existing city Heuristic, not provably optimal but usually does okay 536.6211 476.8667 716.6871 433.0017 505.1939 323.8175 613.9327 443.7259 694.1236 218.8665 819.1546 396.5130... File with locations of 13509 US cities. 14

Algorithm 1: nearest neighbor Tour distance = 77449.98 15

Approximate solution TSP algorithm 2 Data structure = linked list Makes it quick to insert next city anywhere in the list Algorithm = add city into list wherever it causes least increase in total tour length Heuristic, not provably optimal but usually does okay 536.6211 476.8667 716.6871 433.0017 505.1939 323.8175 613.9327 443.7259 694.1236 218.8665 819.1546 396.5130... File with locations of 13509 US cities. 16

Algorithm 2: smallest increase Tour distance = 45075.78 17

3: Recursion Course topics Methods calling themselves Often useful technique for solving a problem Non-recursive solution is always possible, but code would be harder and longer public class Factorial { public static long fact(long n) { if (n <= 1) return 1; return n * fact(n - 1); } } public static void main(string [] args) { System.out.println("4! = " + fact(4)); } 18

Training a language model Call me Ishmael. Some years ago- never mind how long preciselyhaving little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and What letter comes next??? It was a_ I want to go to t_ Need to map an n-gram String to an integer count. n-gram count aa 4 am 1695 an 10435 ao 14 tg 2 th 15570 ti 4246 zz 42 data structure = binary search tree 19

Using the language model Message corrupted in transmission Given language model Recursive algorithm to find most likely messages % java FixCorruptedNbest 5 5 "it wa~~t~~~b~~t~o~~t~m~s~ ~t~~as~t~~~~ors~~~~ ti~~~." < wiki_100k.txt Noisy : it wa~~t~~~b~~t~o~~t~m~s~ ~t~~as~t~~~~ors~~~~ ti~~~. Nbest 0 : it was the best of times, it was the worst of times. Nbest 1 : it was the best of times, it was the worships title. Nbest 2 : it was the best of times, it was the worsenic times. Nbest 3 : it was the best of times, it was the horse of times. Nbest 4 : it was the best of times, it was the worsenic title. 20

4: Threads Course topics One program with multiple threads of execution e.g. background thread to animate progress bar while main program downloads file Sometimes can help simplify program Spawn thread to do a job, go back to something else Processors no longer getting faster Instead they add more and more cores, 2, 4, 6, A multi-threaded programs may be able to use multiple cores at same time, getting job done faster 21

Course topics 5: Socket communication Send information between two programs On the same computer On computers next to each other On computers on different sides of the globe e.g. Building a multi-player network game 22

Course topics 6: Graphical User Interfaces (GUIs) Building interfaces with buttons, etc. Dealing with events Learn to do draw ourselves rather than relying on StdDraw 23

Audience participation What topics are missing? Publish programs (deployment) Cross-platform Mobile app? 24