Welcome to CS 1! Professor Tom Cormen, 204 Sudikoff Lab www.cs.dartmouth.edu/~cs1 Graduate TA: Shruti Agarwal Undergraduate course staff:  Michael Aaberg.

Slides:



Advertisements
Similar presentations
College of Information Technology & Design
Advertisements

Contest format 5 hours, around 8-12 problems One computer running (likely)Linux, plus printer 3 people on one machine No cell phones, calculators, USB.
CPSC 171 Introduction to Computer Science Efficiency of Algorithms.
Taking A Math Test.
CSE 20 Discrete math Prof. Shachar Lovett
Searching Algorithms Finding what you are looking for.
Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
Discrete Structure Li Tak Sing( 李德成 ) Lectures
Algorithm Analysis (Big O) CS-341 Dick Steflik. Complexity In examining algorithm efficiency we must understand the idea of complexity –Space complexity.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 20 Instructor: Paul Beame.
Algorithm Analysis (Big O) CS-341 Dick Steflik. Complexity In examining algorithm efficiency we must understand the idea of complexity –Space complexity.
Searching. 2 Searching an array of integers If an array is not sorted, there is no better algorithm than linear search for finding an element in it static.
Early Term Test Some Study Reminders. General Topics Sources for information to be tested are –My slides and classroom presentations of slides –Chapter.
“It ain’t no good if it ain’t snappy enough.” (Efficient Computations) COS 116: 2/19/2008 Sanjeev Arora.
Searching. 2 Searching an array of integers If an array is not sorted, there is no better algorithm than linear search for finding an element in it static.
CSC 2300 Data Structures & Algorithms January 30, 2007 Chapter 2. Algorithm Analysis.
 2006 Pearson Education, Inc. All rights reserved Searching and Sorting.
Computer Science 102 Data Structures and Algorithms V Fall 2009 Lecture 1: administrative details Professor: Evan Korth New York University 1.
Algorithm Analysis (Big O)
Module 5 Lesson 11. Objective  Use math drawings to represent additions with up to two compositions and relate drawings to the addition algorithm.
CS223 Algorithms D-Term 2013 Instructor: Mohamed Eltabakh WPI, CS Introduction Slide 1.
Conversation Lesson 23: Leaving or Taking a Message.
Let’s do some introductions
“It ain’t no good if it ain’t snappy enough.” (Efficient Computations) COS 116, Spring 2010 Adam Finkelstein.
计算机科学概述 Introduction to Computer Science 陆嘉恒 中国人民大学 信息学院
Computer Science 101 Fast Searching and Sorting. Improving Efficiency We got a better best case by tweaking the selection sort and the bubble sort We.
Forensics and CS Philip Chan. CSI: Crime Scene Investigation high tech forensics tools DNA profiling Use.
Chapter 10 A Algorithm Efficiency. © 2004 Pearson Addison-Wesley. All rights reserved 10 A-2 Determining the Efficiency of Algorithms Analysis of algorithms.
 2005 Pearson Education, Inc. All rights reserved Searching and Sorting.
 Pearson Education, Inc. All rights reserved Searching and Sorting.
February 4, 2005 Searching and Sorting Arrays. Searching.
1. First I sit quietly on the carpet until the teacher asks me to stand. 1. First I sit quietly on the carpet until the teacher asks me to stand.
1 Section 2.1 Algorithms. 2 Algorithm A finite set of precise instructions for performing a computation or for solving a problem.
Lesson 7-4 Pages Solving Inequalities by Adding or Subtracting PA Lesson Check 7-3.
Data Structure and Algorithms. Algorithms: efficiency and complexity Recursion Reading Algorithms.
Program Design. The design process How do you go about writing a program? –It’s like many other things in life Understand the problem to be solved Develop.
CS139 – Algorithm Development Aug 23, 2004 WELCOME!
Sorting.
Computer Science 101 Fast Algorithms. What Is Really Fast? n O(log 2 n) O(n) O(n 2 )O(2 n )
New Mexico Computer Science For All Search Algorithms Maureen Psaila-Dombrowski.
Funders. Welcome- Getting Started. Make a student account in ASSISTment School. Enroll in Mrs. Heffernan’s August 19 th class. Start doing the assignments.
Algorithm Analysis (Big O)
6.4 Completing the Square The Square Root Property.
1 Ch. 2: Getting Started. 2 About this lecture Study a few simple algorithms for sorting – Insertion Sort – Selection Sort (Exercise) – Merge Sort Show.
Data Structures and Algorithms in Java AlaaEddin 2012.
CS321 Spring 2016 Lecture 3 Jan Admin A1 Due this Friday – 11:00PM Thursday = Recurrence Equations – Important. Everyone Should be added to class.
Computer Science Unplugged Dr. Tom Cortina Carnegie Mellon University.
THE “COLLEGES I AM THINKING ABOUT” LIST IN YOUR FAMILY CONNECTIONS ACCOUNT.
Kyle's phone bill is 45 dollars per month. How much does he have to pay for half a year of phone service?
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
CS 154 Formal Languages and Computability May 10 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CMPT 120 Topic: Searching – Part 2 and Intro to Time Complexity (Algorithm Analysis)
Introduction Task Process Evaluation Conclusion Teacher Page.
Searching and Sorting Algorithms
Growth of Functions & Algorithms
CMPT 120 Topic: Searching – Part 2
Algorithmic Efficency
CMSC201 Computer Science I for Majors Lecture 22 – Searching
IGCSE 6 Cambridge Effectiveness of algorithms Computer Science
CMPT 120 Topic: Searching – Part 1
CMPT 238 Data Structures Midterm Exam Review.
Sorting by Tammy Bailey
Data Structures Algorithms: (Slides to be Adopted from Goodrich and aligned with Weiss' book) Instructor: Ganesh Ramakrishnan
Computer Science 102 Data Structures CSCI-UA
Algorithms September 28, 2017.
Welcome to CS 1! Professor Tom Cormen, 204 Sudikoff Lab
Ch. 2: Getting Started.
Unit 2: Computational Thinking, Algorithms & Programming
Homework Check Everyone should have their homework out.
Given that {image} {image} Evaluate the limit: {image} Choose the correct answer from the following:
Presentation transcript:

Welcome to CS 1! Professor Tom Cormen, 204 Sudikoff Lab Graduate TA: Shruti Agarwal Undergraduate course staff:  Michael Aaberg  Mazen Ammar  Ross Bower  Andre Chen  Daniel Chen  Kyle Dotterrer  Ella Dzenitis  Irene Feng  Isabella Florissi  Emily Greene  Vivian Hu  Mahina Kaholokula  Jaki Kimball  Gabrielle Kirlew  Joshua Lang  Justine Lee  Courtney Ligh  Annie Ma  Andrew Meier  Lauren Mitchell  Tim Rizvanov  Anya Rosen  Brophy Tyree  Kristen Vondrak  Lily Xu

Problem 1: Who has my Gumby? Algorithm: A precise sequence of simple steps to solve a problem Algorithm 1 Step 1:Ask someone new if he or she has my Gumby. Step 2:If the answer is yes, then stop: I have found my Gumby. Step 3:If the answer is no and everyone has been asked, then stop: nobody has my Gumby. Step 4:Otherwise (the answer is no but there is someone new to ask), go back to step 1.

Evaluating an algorithm Is our algorithm correct? If it gives an answer, are we sure that the answer is right? Is our algorithm complete? Does it always find the answer, if the answer exists? Is our algorithm efficient? How much time will it take to run? In the best case? In the worst case? Could we implement the algorithm as a computer program?

Problem 2: What is my friend’s phone number? Algorithm 2: Linear search Step 1:Read a new name in the phone book. Step 2:If it’s my friend’s name, then stop: we found my friend’s name and home phone number. Step 3:If not my friend’s name and all names have been read, then stop: my friend’s phone number is unlisted. Step 4:Otherwise (not my friend’s name but there is a new name to read), then go back to step 1.

Problem 2: What is my friend’s phone number? Algorithm 3: Binary search Step 1:Rip the phone book in half. Step 2:Choose the half containing my friend’s name. Discard the other half. Step 3:If what remains is just one page, then search for my friend’s name on that page. Step 4:If what remains is more than just one page, then go back to step 1.

Properties of binary search Would binary search work if the phone book were not sorted by name? How efficient is this algorithm?  How many rips would we need if the phone book contained 2 pages?  4 pages?  8 pages?  16 pages?  32 pages?  256 pages? (Hint: 256 = 2 8 )  1024 pages? (Hint: 1024= 2 10 )  1,048,576 pages? (Hint: 1,048,576= = 2 20 )

Problem 3: How many students shall I tell my colleagues attended CS 1 today? Algorithm 4: Counting in parallel Step 1:Everyone stand up. Think of the number 1. Step 2:Everyone who is standing: find a partner. If an odd number of people are standing, then one person will remain without a partner. Step 3:If you have a partner, then one of you will sit down. Decide between you on who will sit. The one who sits should tell the one who remains standing the number he or she is thinking. Step 4:If you are standing and were told a number, add it to the number you were thinking, and think about this new number. Step 5:If you are the last person standing, report the number you are thinking. Step 6:Otherwise (more than one person is standing), then go back to step 2.

Properties of counting in parallel How many rounds would it take if only 2 people were in the class? 4 people? 8 people? 16 people? How many rounds did it take? Why?