Welcome to CS 1! Professor Tom Cormen, 204 Sudikoff Lab

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.
Learning Objectives Explain similarities and differences among algorithms, programs, and heuristic solutions List the five essential properties of an algorithm.
Chapter 3: The Efficiency of Algorithms
Algorithm Analysis (Big O)
CS223 Algorithms D-Term 2013 Instructor: Mohamed Eltabakh WPI, CS Introduction Slide 1.
Forensics and CS Philip Chan. CSI: Crime Scene Investigation high tech forensics tools DNA profiling Use.
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.
New Mexico Computer Science For All Search Algorithms Maureen Psaila-Dombrowski.
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.
Welcome to CS 1! Professor Tom Cormen, 204 Sudikoff Lab Graduate TA: Shruti Agarwal Undergraduate course staff:  Michael Aaberg.
CMPT 120 Topic: Searching – Part 2 and Intro to Time Complexity (Algorithm Analysis)
Introduction Task Process Evaluation Conclusion Teacher Page.
Module 5 Lesson 16. Objective Subtract from multiples of 100 and from numbers with zero in the tens place.
Component 1.6.
Algorithms.
Searching and Sorting Algorithms
Growth of Functions & Algorithms
CMPT 120 Topic: Searching – Part 2
CompSci 101 Introduction to Computer Science
CMPT 120 Topic: Searching – Part 2
Algorithmic Efficency
Problem Solving Review
CMSC201 Computer Science I for Majors Lecture 22 – Searching
IGCSE 6 Cambridge Effectiveness of algorithms Computer Science
CMPT 120 Topic: Searching – Part 1
Complexity In examining algorithm efficiency we must understand the idea of complexity Space complexity Time Complexity.
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
CMSC201 Computer Science I for Majors Lecture 24 – Sorting
Last Class We Covered Data representation Binary numbers ASCII values
Algorithms September 28, 2017.
Nice to Meet You!.
Title Date To assess my understanding of sequences 30/11/2018
2-3 Trees and the real world and…
Open on the student drive
Algorithms Key Revision Points.
Algorithm and Ambiguity
Research Project Overview
Module 1 Nice to meet you Unit 3 Language in use.
English Course Mrs. Loi A. REVISION
CompSci 1: Principles of Computer Science Lecture 1 Course Overview
Queries.
Lesson 1 Grammar.
Ch. 2: Getting Started.
English Course Mrs. Loi A. REVISION
Warm Up Complete Tuesday’s four questions.
Year 2 Spring Term Week 8 Lesson 2
Introduction to Computer Science I.
Unit 2: Computational Thinking, Algorithms & Programming
CS 150: Computing - From Ada to the Web
Homework Check Everyone should have their homework out.
Year 2 Spring Term Week 8 Lesson 2
Design and Analysis of Algorithms
Early Midterm Some Study Reminders.
Reporting Questions.
What is this course about?
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 www.cs.dartmouth.edu/~cs1 TA: Monika Roznere Undergraduate course staff: Nour Benmohamed Kevin Hoffer-Hawlik Yeonjae Park Rachel Chacko Maxine Perroni-Scharf Janvi Kalra Alex Chan Abenezer Dara Yakoob Khan Ruoni Wang Thomas Kim Linda Xiao Hanting Guo Oliver Mctammany Edward Yao Sarah Gupta Himadry Narasimhamurthy Michelle Yu Lessley Hernandez Shirley Zhang Jiachen Jiang

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 = 28) 1024 pages? (Hint: 1024= 210) 1,048,576 pages? (Hint: 1,048,576= 10242 = 220)

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?