15-122 Homework 2
Page 1 of 7
15-122: Principles of Imperative Computation, Spring 2014
Programming 2: Images
Due: Monday, February 3, 2014 by 22:00
This programming assignment will have you using arrays to represent and manipulate images.
The code handou
Midterm II Exam
15-122 Principles of Imperative Computation, Spring 2012
Andr Platzer Ananda Gunawardena
e
April 5, 2012
Name:
Andrew ID:
Instructions
This exam is closed-book with one sheet of notes permitted.
You have 80 minutes to complete the exam.
Lecture Notes on
Interfaces
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 14
October 14, 2014
1
Introduction
The notion of an interface to an implementation of an abstract data type or library is an extremely important concept in com
Lecture Notes on
Quicksort
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 8
September 18, 2014
1
Introduction
In this lecture we consider two related algorithms for sorting that achieve a
much better running time than the selection so
Lecture Notes on
Hash Tables
15-122: Principles of Imperative Computation
Frank Pfenning, Rob Simmons
Lecture 13
October 9, 2014
1
Introduction
In this lecture we re-introduce the dictionaries that were implemented as a
part of Clac and generalize them as
Lecture Notes on
Sorting
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 6
September 11, 2014
1
Introduction
We begin this lecture by discussing how to compare running times of functions in an abstract, mathematical way. The same under
Lecture Notes on
Binary Search
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 7
September 17, 2014
1
Introduction
One of the fundamental and recurring problems in computer science is to
nd elements in collections, such as elements in
Lecture Notes on
Linear Search
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 5
September 9, 2014
1
Introduction
One of the fundamental and recurring problems in computer science is to
nd elements in collections, such as elements in s
Lecture Notes on
Arrays
15-122: Principles of Imperative Computation
Frank Pfenning, Andr Platzer
e
Lecture 4
September 4, 2014
1
Introduction
So far we have seen how to process primitive data like integers in imperative programs. That is useful, but cert
Lecture Notes on
Ints
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 3
September 2, 2014
1
Introduction
Two fundamental types in almost any programming language are booleans
and integers. Booleans are comparatively straightforward: th
Lecture Notes on
Amortized Analysis
15-122: Principles of Imperative Computation
Rob Simmons, Frank Pfenning
Lecture 12
October 7, 2014
1
Introduction
Most lectures so far had topics related to all three major categories of learning goals for the course:
Lecture Notes on
Restoring Invariants
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 16
October 21, 2014
1
Introduction
In this lecture we will implement operations on heaps. The theme of this
lecture is reasoning with invariants that
15122: Principles of Imperative Computation
Midterm Examination 2
November 3, 2011
There are 19 pages in this examination, comprising 7 questions worth a total of 109 points.
You have 80 minutes to complete this examination.
Please answer all questions
Midterm II Exam
15-122 Principles of Imperative Computation
Anupam Datta, Andr Platzer, Saquib Razak
e
April 8, 2014
Name:
Andrew ID:
Instructions
This exam is closed-book with one sheet of notes permitted.
You have 80 minutes to complete the exam.
The
Midterm II Exam
15-122 Principles of Imperative Computation
Tom Cortina and Rob Simmons
November 6, 2014
Name:
Andrew ID:
Recitation Section (specify letter):
Instructions
This exam is closed-book with one sheet of notes permitted.
You have 80 minutes t
Midterm II Exam
15-122 Principles of Imperative Computation
Tom Cortina and Rob Simmons
November 12, 2013
Name:
Andrew ID:
Recitation Section (specify letter or TA):
Instructions
This exam is closed-book with one sheet of notes permitted.
You have 80 mi
Midterm II Exam
15-122 Principles of Imperative Computation
Frank Pfenning
November 13, 2012
Name:
Andrew ID:
Section:
Instructions
This exam is closed-book with one sheet of notes permitted.
You have 80 minutes to complete the exam.
There are 6 proble
Midterm 2 Exam
15-122 Principles of Imperative Computation
Saquib Razak, Rob Simmons, and Hyrum Wright
March 31, 2015
Name:
Andrew ID:
Recitation Section (specify letter or TA):
Instructions
This exam is closed-book with one sheet of notes permitted.
Yo
Lecture 19 Notes
Data Structures in C
15-122: Principles of Imperative Computation (Fall 2015)
Rob Simmons
In this lecture, we will begin our transition to C. In many ways, the lecture is therefore about knowledge rather than principles, a return to the e
Lecture 11 Notes
Unbounded Arrays
15-122: Principles of Imperative Computation (Summer 1 2015)
Rob Simmons, Frank Pfenning
1
Introduction
Most lectures so far had topics related to all three major categories of learning goals for the course: computational
Lecture Notes on
Priority Queues
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 15
October 16, 2014
1
Introduction
In this lecture we will look at priority queues as an abstract type and discuss several possible implementations. We th
Lecture Notes on
Contracts
15-122: Principles of Imperative Computation
Frank Pfenning
Lecture 2
August 28, 2014
1
Introduction
In these notes we review contracts, which we use to collectively denote
function contracts, loop invariants, and other assertio
Lecture Notes on
Linked Lists
15-122: Principles of Imperative Computation
Frank Pfenning, Rob Simmons, Andr Platzer
e
Lecture 11
September 30, 2014
1
Introduction
In this lecture we discuss the use of linked lists to implement the stack and
queue interfa
Lecture 10
Linked Lists
15-122: Principles of Imperative Computation (Fall 2016)
Frank Pfenning, Rob Simmons, Andr Platzer
1
Introduction
In this lecture we discuss the use of linked lists to implement the stack and
queue interfaces that were introduced i
Lecture 3
Arrays
15-122: Principles of Imperative Computation (Fall 2016)
Frank Pfenning, Andr Platzer
1
Introduction
So far we have seen how to process primitive data like integers in imperative programs. That is useful, but certainly not sufficient to h
Lecture 4
Searching Arrays
15-122: Principles of Imperative Computation (Fall 2016)
Frank Pfenning
1
Introduction
One of the fundamental and recurring problems in computer science is to
find elements in collections, such as elements in sets. An important
15-122: Principles of Imperative Computation
Recitation 24
Matt Dee
The Last Lecture Recitation
Below is a (non-exhaustive) list of testable topics covered this semester for the nal exam. You can
use this, in conjunction with the old exams that we have po
15-122: Principles of Imperative Computation
Recitation 12
Nivedita Chopra
Administrivia
There is a quiz today and it closes at 10 p.m. as usual
Midterm on Tuesday and held in two rooms. See the post on Piazza for details.
Review session for midterm on
15-122 Homework 6
Page 1 of 11
15-122: Principles of Imperative Computation, Spring 2014
Homework 6 Programming: Peg Solitaire
Due: Monday, March 24, 2014 by 22:00
For the programming portion of this weeks homework, you will implement a program to
solve p
15-122 Homework 7
Page 1 of 8
15-122: Principles of Imperative Computation, Spring 2014
Homework 7 Programming: String Buers
Due: Monday, March 31, 2014 by 22:00
In this programming assignment we will explore a useful data structure for working with
strin
Lecture 1
Contracts
15-122: Principles of Imperative Computation (Fall 2016)
Frank Pfenning
1
Introduction
In these notes we review contracts, which we use to collectively denote
function contracts, loop invariants, and other assertions about the program.
Lecture 7
Quicksort
15-122: Principles of Imperative Computation (Fall 2016)
Frank Pfenning
1
Introduction
In this lecture we consider two related algorithms for sorting that achieve
a much better running time than the selection sort from an earlier lectu
Lecture 11
Unbounded Arrays
15-122: Principles of Imperative Computation (Fall 2016)
Rob Simmons, Frank Pfenning
1
Introduction
Arrays have efficient O(1) access to elements given an index, but their size
is set at allocation time. This makes storing an u
Lecture 2
Ints
15-122: Principles of Imperative Computation (Fall 2016)
Frank Pfenning
1
Introduction
Two fundamental types in almost any programming language are booleans
and integers. Booleans are comparatively straightforward: they have two
possible va
Lecture 6
Binary Search
15-122: Principles of Imperative Computation (Fall 2016)
Frank Pfenning
1
Introduction
One of the fundamental and recurring problems in computer science is to
find elements in collections, such as elements in sets. An important alg