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 2420 Class Notes Week 3

by: Nick

CS 2420 Class Notes Week 3 CS 2420

Marketplace > University of Utah > Computer science > CS 2420 > CS 2420 Class Notes Week 3
The U
GPA 3.78

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

Algorithmic complexity, Big O notation, binary search, asymptotic behavior
Intro Algorithms and Data Structures
Miriah Meyer
Class Notes
Computer Science, algorithms, data structures
25 ?




Popular in Intro Algorithms and Data Structures

Popular in Computer science

This 4 page Class Notes was uploaded by Nick on Friday September 9, 2016. The Class Notes belongs to CS 2420 at University of Utah taught by Miriah Meyer in Fall 2016. Since its upload, it has received 9 views. For similar materials see Intro Algorithms and Data Structures in Computer science at University of Utah.


Reviews for CS 2420 Class Notes Week 3


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: 09/09/16
CS 2420 9­7­16 Complexity next assignment requires a partner due next wed TAs will not be able to help unless both you and your partner are together.  have one week to ask for regrade.  email TAs directly don’t leave comments in the assignment submissions need to include name in every assignment. name and UID at the top of every file.  In the future need to add javadoc comments! no javadocs on tests get answers about code in person not on email. expect 5­15 hours per assignment if spent more than 20 hours, then this will be an especially hard class for you.  generic programming generic placeholder type is very specific ArrayList<Shape> will treat a Triangle as a Shape. wildcard placeholder: ? < ? super Circle>  <?> is so unspecific it is basically useless.  Comparable interface Comparator interface Collection is a generic data structure that holds items. does not say how they are held.  Iterator allows iterating (think for loop) through a data structure without a for loop.  Algorithm analysis Correctness is only half the battle.  in this class will expect programs to terminate ina certain amount ot time.  this is determined by the choice of algorithm to find a word in a paper dictionary: algorithm 1: one at a time starting at the beginning.  algorithm 2: go to middle word is this our word, if so done if not then if greater go to middle word of the greater half else go to middle word of lesser half 180K words algorithm1: 12 hours [linear] algorithm 2: 4 seconds [binary] Binary search: n# words searches 180k 1 90k 1 45k 1 … 75 1 36 1 … 4 1 2 1 1 1 total of 18 searches * .25 sec = 4 seconds 180000=~2^18  N=2^x  x is number of searches needed to find the word. x=log2(N) log refresher: log B (N) = x B^x=N default base in this class is 2 9 < log 1000 < 10 T is the time for N 2*linear search = 2*T 2*binary search = T+1 Determine complexity of code: count number instructions assume one insruction is: assigning a value to a variable looking up the valueof a particular array element cmopareing 2 values incrementing a value basic arithmetic ops branching is instantaneous ex int max = array[0]; has an instruction count of 2: assign and lookup int i=0; i<n each have one no matter what N is total of 4 every iteration: 2n i<n i++ body of loop: 2n array[i] > max max = array[i]; worst case: max number of work best case: minimum number of instructions: 4+2n+2n+2n #instructions = f(n)=6n+4  but time will vary by computer, language, compiler, available CPU but they are beyond our control asymptotic behavior just keep the fastest growing term.  we will ignore constants, and coefficients (decorative constants) examples: f(n)=5n+12 → n f(n)=109 → 1=n^0 f(n)=n^2+3n+112 → n^2 f(n)=n^3+1999 → n^3 f(n)=n+n^(½) → n no loop has asymptotic behavior of 1 single loop from 1­­>n is n n^2 and n^3 are not acceptable in this class.  log growth comes from iterations of 2*n or n/2 Big O notation used to capture run­time behavior assume large N O(N^2) = “order n squared” clever programming tricks cannot make an inefficient algorithm fast.  so, optimizing the algorithm will do better than optimizing the code worst case average case ­ the most useful best case­ usually don’t care


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!"

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

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.