2015/09/28
Recursion: Introduc/on
1
Announcements
First wri4en exam next week (Wed. Oct 7 )
All material from beginning is fair game
There will be sample exams on the resource page
If you need special accommoda/ons
8/31/2015
COURSE OVERVIEW
Dilsun Kaynar, CMU
August 31, 2015
Students From Different Disciplines
Basic Sciences
Engineering
Psychology
Business
Modern Languages
Fine Arts
Others .
2
1
8/31/2015
Why Are You Here?
Curiosity: find out about computing
Organizing Data:
Arrays, Linked Lists
15-110
10/5/2015
Announcements
Exam information
Lecture1 (2:30-3:30): If you are in section G or H, you will be
taking the exam in Hamerschlag Hall B131 (this is in the B
basement of the building with the rotunda at
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by Ca
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Generated by CamScanner
Brittany Chen
Course: 15-110
Section: A
Problem Set 1
1.) The extra beads in the Chinese abacus are for hexadecimal computing. When
the Chinese introduced the abacus to Japan, they developed their own version of
the abacus, without the hexadecimal feature
Brittany Chen
Course: 15-110
Section: A
Due 2.21.13
Problem Set #5
1.)
def sum(n)
if n= 0
return 0
else
return n + sum(n-1)
end
end
2.)
def print_stars(n)
if (n=0) then
print "\n"
else
print("*")
print_stars(n-1)
end
end
def print_triangle(n)
if n = 0
ret
Brittany Chen
Course: 15-110
Section: A
Due: 2/7/2013
1.)
X
21
49
21
7
Y
49
21
7
0
Temp
49
21
7
P
1029
1029
1029
147
Q
147
49
21
2.)
a.)
def compute_average(n)
total = 0
i=1
while i <= n do
total = i + total
i=i+1
end
return total/n
end
b.)
def compute_av
2015/09/16
Algorithmic Thinking:
Loops and Conditionals
Announcements
Programming Assignment 2 is due tomorrow (Tuesday)
night at 11:59pm.
Problem Set 2 has been posted and due this Friday in
lecture.
1
2015/09/16
Last Time
A control flow structu
2015/09/16
Algorithmic Thinking:
Computing with Lists
So Far in Python
Data types: int, float, Boolean, string
Assignments, function definitions
Control structures: For loops, while loops, conditionals
1
2015/09/16
Exercise
Write a function that
2015/09/18
Algorithmic Thinking:
Sieve of Erathosthenes
Last Time
Lists
Creating new lists
Accessing and updating elements
Looping over lists
1
2015/09/18
A 2000 year old algorithm
(procedure) for generating a table
of prime numbers.
2, 3, 5, 7,
2015/09/30
UNIT 5B
Binary Search
1
Course Announcements
Written exam next week (Wed. Oct 7 )
Practice exam available on the Resources page
Exam reviews: Sunday afternoon;
watch Piazza for times and places
Problem Set 5 will be due as usual on the
Frid
2015/10/02
UNIT 5C
Merge Sort
15110 Principles of Computing, Carnegie
Mellon University
1
Course Announcements
Exam information
2:30 Lecture: Sections F, G, H will go to HH B131.
3:30 Lecture: Section O will go to GHC 4101 (
Section P will to to GHC 52
9/2/2015
Part 1: Computing Before World War 2
Part 2: Programming with Blocks
Last Time
Course overview
Course logistics
Readings for week
Blown to Bits, Chapter 1
Academic Integrity form to be read,
signed, and returned tomorrow in the
lab. Available on
UNIT 4B
Iteration: Sorting
15110 Principles of Computing
Carnegie Mellon University
1
Last Time
Unicode
Iteration
Searching
Execution time
15110 Principles of Computing
Carnegie Mellon University
2
This time: overview
A word on the appearanc
UNIT 4C
Iteration: Scalability &
Big O Notation
15110 Principles of Computing
Carnegie Mellon University
1
Last Time
Insertion Sort Algorithm
15110 Principles of Computing
Carnegie Mellon University
2
This Lecture
Now it is time to thi
9/4/2015
Part 1: Computing from WW2 to
Present
Part 2: Towards Programming with
Python
Announcement
No lecture on Monday Sep 7th, Labor Day.
1
9/4/2015
Early Electronic Computers
Electromechanical Harvard Mark I
Purely electronic ENIAC, Colossus, Atana
UNIT 4A
Iteration:
Searching
15110 Principles of Computing,
1
Carnegie Mellon University
Last Week
Algorithms
Sieve of Eratosthenes
15110 Principles of Computing,
Carnegie Mellon University
2
Goals of this Unit
Understand simple mechanical
UNIT 2A
An Introduction to Programming
15110 Principles of Computing
Carnegie Mellon University
1
Overview
Announcements
The nature of programming languages
Introduction to Python
expressions
statements
methods / functions
15110 Princi
Brittany Chen
Course: 15-110
Section: A
Problem Set #2
1.)
a.) 1 + 2 * 3 / 4 5
=1 + 6 / 4 5
=1 + 1 5
= -3
b.) 4 *3 *2 *5
=4 * 9 * 5
= 180
c.) 6 * 9 % 5
54%5
=4
d.) 2 + 10 * 8 5
2 + 80 5
=77
2.)
a.) We would get a floating point result because finding the
Brittany Chen
Course: 15-110
Section: A
Problem Set #6
1.)
Def find_sub_sum(matrix, row_start, row_end, col_start, col_end)
Sum = 0
If matrix[row].length = matrix[col].length then
Return nil
Else
For row in row_start.row_end do
For col in col_start.col_en
The coherence is the complex-valued function dened by
fXY (! )
XY (! ) = p
.
fX (! )fY (! )
measure of linear association between X and Y at frequency omega
Saturday, October 27, 12
The coherence is the complex-valued function dened by
fXY (! )
Factors that shape motor planning
Steven M. Chase
Assistant Professor
CNBC & BME
What factors shape a reaching movement?
What factors shape a reaching movement?
Target location
Target size/shape
Reward
Smoothness
Straightness
History!
When we did this rea
Problem 1: mostFrequentWord (30 points)
Write a function, mostFrequentWord(text), that takes a string containing perhaps a large amount
of text and returns the most frequent word in that text (in uppercase). You must use this
approach: first, convert the
With this description in mind, write the function mastermindScore(code, guess),
which takes two lists of length 4, a code and a guess as just described, and returns a
new list of length 2 containing the score for the given guess. The first value in the
sc
3C) [5pts] isLegalCol(board, col)
This function works just like the isLegalRow function, only for columns, where
column 0 is the leftmost column and column 8 is the rightmost column. Similarly to
isLegalRow, this function must create a 1d list of length 9
Problem 4: Mystery code (10 points)
This week's mystery code problems are somewhat different than in past assignments.
In the zip folder, you will find the file mysteryCode1.py. This contains a complete
Mastermind game with a (not too elegant, but functio
5B) [2pts] generateSimpleSudoku(difficulty)
Write a the function generateSimpleSudoku that takes a difficulty level (a float from
0.0 for low to 1.0 for high), and returns a randomly-generated Simple Sudoku (as a
9x9 2d list of integers) of the given diff