Compsci 06/101, Fall 2010 11.1 What's ahead in Compsci 6/101? l Software architecture and design, why Jotto has modules and how communication works  We.

Slides:



Advertisements
Similar presentations
An Introduction to Hashing. By: Sara Kennedy Presented: November 1, 2002.
Advertisements

Information Communication and Technology Class By: Mr. Latibeaudiere March, 2011.
Lecture 05 – Dictionaries.  Consider the following methods of sorting information in a sequence. What is the output produced by each program? 2COMPSCI.
Dictionaries Last half of Chapter 5. Dictionary A sequence of key-value pairs – Key is usually a string or integer – Value can be any python object There.
TEMPLATE DESIGN © SSAHA: Search with Speed Nick Altemose, Kelvin Gu, Tiffany Lin, Kevin Tao, Owen Astrachan Duke University.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
CSC230 Software Design (Engineering)
CSE 143 Lecture 7 Sets and Maps reading: ; 13.2 slides created by Marty Stepp
CIS Computer Programming Logic
CompSci 105 SS 2005 Principles of Computer Science Lecture 4 Lecturer: Santokh Singh.
TEMPLATE DESIGN © Haha  SSAHA Kelvin Gu, Tiffany Lin, Nick Altemose, Kevin Tao Duke University, Trinity College of Arts.
Hash Functions and the HashMap Class A Brief Overview On Green Marble John W. Benning.
CS212: DATA STRUCTURES Lecture 10:Hashing 1. Outline 2  Map Abstract Data type  Map Abstract Data type methods  What is hash  Hash tables  Bucket.
Data Abstraction UW CSE 140 Winter What is a program? – A sequence of instructions to achieve some particular purpose What is a library? – A collection.
Compsci 06/101, Fall Compsci 6/101: Sept 6-10 l We've looked at the language Python  Names and types: int, float, long, String, file, …  Operations:
CompSci Maps  Maps are another way of organizing data  Keys and Values  Each key maps to a value  Some keys can map to the same value  Can.
Python Lists and Such CS 4320, SPRING List Functions len(s) is the length of list s s + t is the concatenation of lists s and t s.append(x) adds.
Min Chen School of Computer Science and Engineering Seoul National University Data Structure: Chapter 10.
Beyond Lists: Other Data Structures CS303E: Elements of Computers and Programming.
CompSci Today’s topics Java Review Just a bunch of headings meant to trigger questions A contraction of previous notes Upcoming Midterm Exam Reading.
Analyzing algorithms & Asymptotic Notation BIO/CS 471 – Algorithms for Bioinformatics.
Women in CS Ciarán Llachlan Leavitt Imager Lab, Dept. of Computer Science & Vania Chan CPSC 101 TA.
ISpheresImage iSpheresImage Feature Overview and Progress Summary.
Compsci 06/101, Fall What will you do in Compsci 6 Today? l Learn about selection and if/else statements  In context of solving problems  Understanding.
Data structures Abstract data types Java classes for Data structures and ADTs.
How to Read Code Benfeard Williams 6/11/2015 Susie’s lecture notes are in the presenter’s notes, below the slides Disclaimer: Susie may have made errors.
TODAY’S Lesson   Searching on the Internet . VOCABULARY  Search Engine  Web site  Spider  String/Indexer  Server  Link  Boolean  Query.
Getting Started with Python: Constructs and Pitfalls Sean Deitz Advanced Programming Seminar September 13, 2013.
Compsci 100, Fall What is Computing? Informatics? l What is computer science, what is its potential?  What can we do with computers in our lives?
Compsci 6/101, Spring More on Python, Tools, Compsci 101 l APTs, Assignments, Tools  APT: Algorithmic Problem-solving and Testing  How to get.
CompSci 6 Introduction to Computer Science November 1, 2011 Prof. Rodger.
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
Chapter 14 Advanced Function Topics CSC1310 Fall 2009.
Compsci 06/101, Fall Vocabulary l What's the Spanish word for 'boy'? 'eat'?  How do you know? l What about the Turkish equivalents?  How do.
Compsci 101.2, Fall Plan for FFWOO l Programming in the small and in the large  Making one function work correctly, especially in the context.
1 Joe Meehean.  List of names  Set of names  Map names as keys phone #’s as values Phil Bill Will Phil Bill Will Phil Bill Will Phil: Bill:
Building Java Programs Bonus Slides Hashing. 2 Recall: ADTs (11.1) abstract data type (ADT): A specification of a collection of data and the operations.
By Jeff Dean & Sanjay Ghemawat Google Inc. OSDI 2004 Presented by : Mohit Deopujari.
More Perl Data Types Scalar: it may be a number, a character string, or a reference to another data type. -the sigil $ is used to denote a scalar(or reference)
JSON COMPSCI 105 S Principles of Computer Science.
Compsci 101.2, Fall Plan for 11/9 and 11/11 l Reviewing Concepts for test  Loops: index and by element  Strings, Lists, Sets, Dictionaries.
Compsci 101.2, Fall Plan for October 29 l Review dictionaries and their use  Very efficient, easy to use  Efficiency doesn't matter much for.
Coding Time This is a starter activity and should take about 10 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.Start a script session (Select.
Compsci 6/101, Spring WBFSB l Plan for this week  Get test back, review, look for problems/weaknesses  How to address these?  Assignments.
Compsci 101.2, Fall Plan for eleven-four l Thinking about APTs and test problems  How do you choose: list, string, set, dictionary  Experience?
CPS 49S Google: The Computer Science Within and its Impact on Society Shivnath Babu Spring 2008.
Tutorial 10 Dictionaries and Classes. Reminder Assignment 09 is due FRIDAY, Dec 4 at 4:00 pm.
Compsci 6/101, Spring PFTW: Functions, Control, Python/Tools l How do functions work and why do we use them?  Functions we call (APIs), Functions.
Compsci 101.2, Fall Plan for October l Structuring Data and Code for Efficiency  Computer time, how expensive is it?  Data storage, how.
Dictionaries Intro to Computer Science CS 1510 Dr. Sarah Diesburg.
Boat Racing Game Challenge #3 By Chris Brown Under the direction of Professor Susan Rodger Duke University, January 2013 Based off of the Boat Racing Game.
Compsci 06/101, Spring This week in Compsci 6/101 l From sets to dictionaries  Incredibly powerful in solving problems  Power in Perl, Python,
Data Abstraction UW CSE 160 Spring What is a program? – A sequence of instructions to achieve some particular purpose What is a library? – A collection.
Computer Science & Engineering 2111 Database Objects 1 CSE 2111 Introduction to Database Management Systems.
CPS Searching, Maps, Tables l Searching is a fundamentally important operation ä We want to do these operations quickly ä Consider searching using.
CompSci 101 Introduction to Computer Science March 24, 2016 Prof. Rodger compsci 101, spring
Chapter 6 Functions The Tic-Tac-Toe Game. Chapter Content In this chapter you will learn to do the following: 0 Write your own functions 0 Accept values.
Equality, references and mutability COMPSCI 105 SS 2015 Principles of Computer Science.
Fundamentals of Programming I Higher-Order Functions
PFTD and PFTW Review hashing from intuitive view point, from general viewpoint, from Java 8 viewpoint Try to isolate dependencies on Java, but knowledge.
What is a Literary Fingerprint?
CompSci 101 Introduction to Computer Science
Introduction to Python
Road Map CS Concepts Data Structures Java Language Java Collections
Sets (11.2) set: A collection of unique values (no duplicates allowed) that can perform the following operations efficiently: add, remove, search (contains)

Data Abstraction UW CSE 160 Spring 2018.
CompSci 101 Introduction to Computer Science
Sets (11.2) set: A collection of unique values (no duplicates allowed) that can perform the following operations efficiently: add, remove, search (contains)
Data Abstraction UW CSE 160.
Presentation transcript:

Compsci 06/101, Fall What's ahead in Compsci 6/101? l Software architecture and design, why Jotto has modules and how communication works  We write small programs, want to understand some principles of larger programs  Software design in the small and in the large: different! l Dictionaries: associating keys with values  Arguably the most useful method for structuring data  How does Google find 'good' sites for a query?  How do we find what region in a genome encodes a protein?  How do we determine literary/other fingerprints?

Compsci 06/101, Fall Jotto: The Program Architecture l You write jottoModel.py  This is the guts, brains, state of the program  Keeps track of how the game is progressing  Functions in the module communicate via global state l We provide two views: command-line and GUI  These all you to view and control the model  Both view-controllers: jottoMain.py and jottoGui.py know about the model, but model doesn't know about them l Model-View or Model-View-Controller  Often the model knows there is/are view(s) not Jotto

Compsci 06/101, Fall Maria Klawe Chair of Computer Science at UBC, Dean of Engineering at Princeton, President of Harvey Mudd College, ACM Fellow,… Klawe's personal interests include painting, long distance running, hiking, kayaking, juggling and playing electric guitar. She describes herself as "crazy about mathematics" and enjoys playing video games. "I personally believe that the most important thing we have to do today is use technology to address societal problems, especially in developing regions"

Compsci 06/101, Fall Useful Computer Science l a n+St,+Durham,+NC (Blue+Coffee+Express)&daddr=2324+Duk e +University+Road,+Durham,+NC+27708&hl=en&geocode=FcNJJQIdYw 5 M-yGT6vAZOfvdQg%3B&mra=ls&sll= , &sspn= , a n+St,+Durham,+NC (Blue+Coffee+Express)&daddr=2324+Duk e +University+Road,+Durham,+NC+27708&hl=en&geocode=FcNJJQIdYw 5 M-yGT6vAZOfvdQg%3B&mra=ls&sll= , &sspn= , Blue Coffee Express Durham 2324 Duke University Road

Compsci 06/101, Fall How does this work? l

Compsci 06/101, Fall What is a dictionary, map, hash, table? l Abstraction: collection of (key,value) pairs  What kind of ice-cream do you like?  You are the key, ice cream is the value Robert Susan Jeff Alex Bruce Sam

Compsci 06/101, Fall What does this code do? How? def fileStatsList(filename): file = open(filename) statList = [] for word in file.read().split(): found = False for pair in statList: if pair[0] == word: pair[1] += 1 found = True break if not found: statList.append([word,1]) file.close() return statList

Compsci 06/101, Fall Faster, Cheaper, Totally in Control def fileStatsDictionary(filename): file = open(filename) stats = {} for word in file.read().split(): if word in stats: stats[word] += 1 else: stats[word] = 1 file.close() return stats

Compsci 06/101, Fall Accessing map l Index a map by a key, using […]  Like indexing a list, but index is a string, …. not integer!  Works internally by associating a number with the key  This association is known as hashing the key l Methods for dictionaries: .clear(),.get(key),.get(key,default) .keys(),.values(),.items() l When using iteration or x in d, we're talking keys  Iterate over keys, query about keys, and so on

Compsci 06/101, Fall Literary Fingerprint l Timing and playing with code in fingerPrint.py  How do we find out how fast this is?  How do we change the format of the output?  Can we organize output differently? l How can we find 'other' fingerprints  Shazaam, genome, images  What will be the key, what will be the value?