Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Computational Thinking Notes

Rating
-
Sold
-
Pages
14
Uploaded on
29-08-2021
Written in
2019/2020

notes for midterm consolidated

Institution
Course

Content preview

Notes for midterm

• Computational thinking—fundamental skill for everyone; Most fundamentally addresses the question:
What is computable?; way that humans think, conceptualizing, fundamental, ideas

• Two trends not to be missed:

The growing scale of available data; The shrinking time to make decisions

• A matching is stable if there is no pair, who are not matched, but would prefer each other
to their current matched partners. (deferred choice algorithm



Counting:

Product rule--If there are m ways to do one thing, and n ways to do another thing, then there are m
x n ways of doing both things. –both to be done at the same time (and)

Sum rule--If there are m ways to do one thing, and n ways to do another thing, and both things
cannot be done at the same time, then there are m + n ways of doing only one of the things. –OR

Inclusion-exclusion principle--If two things can be done at the same time, the sum rule will lead to
double counting. In this case, we add the number ways to do each task, and then subtract the
number of ways to do both tasks. (e.g. multiples)



Permutations--A permutation of a set of objects is an ordered arrangement of these objects.

P(n, n) = n! The number of permutations of a set of length n is n!

An r-permutation of a set of n objects is an ordered arrangement of r of the n objects

Permutation: order/sequence is important
n
Pr = n! / (n - r)!

N: number of items; R: number of items taken at a time



Combinations--A combination of a set of objects is an unordered selection of these objects.

C (n, n) = 1 The number of combinations of a set of length n is 1.

Combinations: order is not important; only the grouping combo

The number of combinations of a set of length n is 1.

An r-combination of a set of n objects is an unordered selection of r objects out of the n objects.
n
Cr =n! / r!(n - r )!

e.g. out of 45 students, you want to select 5 students (combination); however, if you want to assign
the students to different positions, then it’s a permutation problem

Special cases:

, How many ways are there for n men and n women stand in a line so that no two women stand next
to each other? Total = n! x n+1Cn x n!


Table problem: How many ways are there to seat six people around a circular table where two
seatings are considered the same when everyone has the same two neighbors without regard to
whether they are right or left neighbors? 6!/6*2 --> because when left and right are the same, 6! is
the number of possible combination, divided by 6 cos is the same going down the table by shifting so
eliminate and *2 cos must consider the reverse

Line problem: A group contains n men and n women. How many ways are there to arrange these
people in a row if the men and women alternate? n!*n!*2

How many positive integers between 100 and 999 inclusive: find the integer divisible by 7 that is
closest to 100 and 999→(994-105)/7 + 1


Algorithm—inputs, outputs, operations; must be precise (understandable), effective (solves the
problem), practical

Brute force algorithm—For two numbers a and b, its gcd is between 1 and the minimum of a and b;
try all possibilities

Written for

Institution
Course

Document information

Uploaded on
August 29, 2021
Number of pages
14
Written in
2019/2020
Type
Class notes
Professor(s)
Daniel lin
Contains
All classes

Subjects

$7.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
nemooutis
1.0
(1)

Get to know the seller

Seller avatar
nemooutis Singapore Management University
Follow You need to be logged in order to follow users or courses
Sold
4
Member since
4 year
Number of followers
3
Documents
40
Last sold
2 year ago

1.0

1 reviews

5
0
4
0
3
0
2
0
1
1

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions