New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

CS 1110, Week 12 Notes

by: Eunice

CS 1110, Week 12 Notes CS 1110-002


Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Redefining Computations Copying Recursion (Linear and Binary Search)
Intro to Computing using Python
Lee, Van Loan
Class Notes
CS, Python
25 ?




Popular in Intro to Computing using Python

Popular in ComputerScienence

This 2 page Class Notes was uploaded by Eunice on Friday April 22, 2016. The Class Notes belongs to CS 1110-002 at Cornell University taught by Lee, Van Loan in Spring 2016. Since its upload, it has received 16 views. For similar materials see Intro to Computing using Python in ComputerScienence at Cornell University.


Reviews for CS 1110, Week 12 Notes


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 04/22/16
CS 1110 Van Loan and Lee Spring 2016 April 19, 2016  Redefining computations (+ or -) o example: SimpleDate class  create methods to calculate in leap years and lengths of months  redefine + to add days instead of attempting concatenation by creating an __add__ method  similarly, for – and subtraction, __sub__  for ==, __eq__  copying objects: o B = copy(A)  copying an object doesn’t reproduce a copy of its references o B = deepcopy(A)  complete copy including its references  New Material (not on prelim 2) o Recursion  functions that call themselves  patterns that are defined by the terms of itself  consider levels  at each level, execute a certain procedure respective to the level  (with triangles and fractals, consider each inner triangle a new level)  factorial example  if an execution can be reapplied with n-1 (n being the major variable at hand), recursion could be applied  a base case: the condition or point at which the recursion stops April 21, 2016  Searching a List (example being searching a list of integers) o Linear Search: data is unordered  method: iterate and go down a line  no match case: return -1  while implementation vs. for implementation  while: while there’s no match  for: check for each whether it’s a match  if there are multiple cases, without further specification, it will just return the first match case o Binary search: assume/specify that the list to be searched is sorted from little to big  when the length of the list increased by a certain constant, the time it takes to search the list does not equally scale  method: check half, discard the half that does not include the match  ex. if you have a name to find in an alphabetized list, check half and if the name falls within the letters of that half  math: log 2n)  code: find midpoint (Mid), discard either preceding or following half (halving the size of the search space) o L: left endpoint; R: right endpoint; Mid: (L+R)/2  at the end of the loop, compare the end points (which are the two remaining values to check for matches) o a recursion o Benchmarking (check how long a code takes)  the longer the list, the binary method is fastest  the linear method, for loop is second; linear method, while loop is the slowest  while loop test condition is complicated


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Kyle Maynard Purdue

"When you're taking detailed notes and trying to help everyone else out in the class, it really helps you learn and understand the I made $280 on my first study guide!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.