Happy Birthday Julia Courier New. USACO December Contest - Congratulations to Jon+Julia+Andy for promoting to gold And Johnny - 2th place in gold among.

Slides:



Advertisements
Similar presentations
© 2004 Goodrich, Tamassia Pattern Matching1. © 2004 Goodrich, Tamassia Pattern Matching2 Strings A string is a sequence of characters Examples of strings:
Advertisements

Intro to CS – Honors I Representing Numbers GEORGIOS PORTOKALIDIS
Analysis of Algorithms
Registers and Counters. Register Register is built with gates, but has memory. The only type of flip-flop required in this class – the D flip-flop – Has.
(())()(()) ((())()(())()(()))
Intro to USACO Strategy
I couldn’t think of anything to put here. So have a cow. Or two.
3.12 ≠ π What an inspiring title. PotW Solution - Bovinekiin int stall = 0; for (int i = 0; i calcGreedy(best)) { best = new ArrayList (cur); // update.
Digital Images in Java The structure of code and concept
Insertion sort, Merge sort COMP171 Fall Sorting I / Slide 2 Insertion sort 1) Initially p = 1 2) Let the first p elements be sorted. 3) Insert the.
Pattern Matching1. 2 Outline and Reading Strings (§9.1.1) Pattern matching algorithms Brute-force algorithm (§9.1.2) Boyer-Moore algorithm (§9.1.3) Knuth-Morris-Pratt.
Analysis & Design of Algorithms (CSCE 321)
Lecture 38 CSE 331 Dec 7, The last few days Today: Solutions to HW 9 (end of lecture) Wednesday: Graded HW 9 (?), Sample final, Blog post on the.
USACOW: The Aftermath. PotW Solution Scanner s = new Scanner(System.in); int n = s.nextInt(), k = s.nextInt(), x = 0; for (int i = 0; i < n; i++) x ^=
CS 112 Intro to Computer Science II Sami Rollins Spring 2007.
Pattern Matching1. 2 Outline Strings Pattern matching algorithms Brute-force algorithm Boyer-Moore algorithm Knuth-Morris-Pratt algorithm.
Value Iteration 0: step 0. Insertion Sort Array index67 Iteration i. Repeatedly swap element i with.
They are the same as registers since they store binary numbers. Called shifting registers since they shift (left or right) the binary number stored in.
1.7 Arrays academy.zariba.com 1. Lecture Content 1.Basic Operations with Arrays 2.Console Input & Output of Arrays 3.Iterating Over Arrays 4.List 5.Cloning.
CSE Lectures 22 – Huffman codes
Approaches to Problem Solving greedy algorithms dynamic programming backtracking divide-and-conquer.
Lecture 23: Finite State Machines with no Outputs Acceptors & Recognizers.
Jessie Zhao Course page: 1.
IT253: Computer Organization Lecture 3: Memory and Bit Operations Tonga Institute of Higher Education.
Houyang 3/25/13. USACO March Contest Congrats to Johnny Ho for scoring over 900 points in the Gold Division o 7th place in US Kudos to Jonathan Uesato.
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
MA/CSSE 473 Day 18 Permutations by lexicographic order number.
Numbering System Base Conversion. Number systems Decimal – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary – 0, 1 Octal – 0, 1, 2, 3, 4, 5, 6, 7 Hexadecimal system.
Bitwise operators. Representing integers We typically think in terms of decimal (base 10) numbers.  Why?  A decimal (or base 10) number consists of.
Public void main What do you call something that’s not static?
Homework #5 New York University Computer Science Department Data Structures Fall 2008 Eugene Weinstein.
April 6, 1998CS102-02Lecture 2-1 Java Operators CS Lecture 2-1 Being a Smooth Operator.
Description of a New Variable-Length Key, 64-Bit Block Cipher (BLOWFISH) Bruce Schneier BY Sunitha Thodupunuri.
Bits, Data types, and Operations: Chapter 2 COMP 2610 Dr. James Money COMP
Bitwise operators. Representing integers We typically think in terms of decimal (base 10) numbers.  Why?  A decimal (or base 10) number consists of.
Bit-String Flicking.
Honors Track: Competitive Programming & Problem Solving Optimization Problems Kevin Verbeek.
4. Computer Maths and Logic 4.2 Boolean Logic Logic Circuits.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Happy Birthday Tony Palindromes.
CS320n –Visual Programming
Stacks and Queues. Announcements USACO Open competition results are out o Congrats to Johnny for scoring 2nd in the US USACO Finalists are also announced.
The SECOND Meeting Or: How I learned exciting new things in CS Club.
Click to add title Click to add lame programming pun.
10/12/2015 Updated from Alex’s excellent note
CSE 351 Number Representation & Operators Section 2 October 8, 2015.
Main Index Contents 11 Main Index Contents Complete Binary Tree Example Complete Binary Tree Example Maximum and Minimum Heaps Example Maximum and Minimum.
Analysis & Design of Algorithms (CSCE 321)
CSE 351 Number Representation. Number Bases Any numerical value can be represented as a linear combination of powers of n, where n is an integer greater.
Bringing Together Paradox, Counting, and Computation To Make Randomness! CS Lecture 21 
CS320n – Elements of Visual Programming Assignment Help Session.
Lecture 2: Logic Bryan Burlingame 10 Feb Ref: xkcd:
Theory of Computational Complexity Yusuke FURUKAWA Iwama Ito lab M1.
Number Systems Decimal Can you write 12,045 in expanded form? Base? Allowable digits for each place?
NAME THAT ALGORITHM #2 HERE ARE SOME PROBLEMS. SOLVE THEM. GL HF.
Lecture 3: Logic Bryan Burlingame 06 Sept 2017.
Instructor: David Ferry
13 Text Processing Hongfei Yan June 1, 2016.
What to bring: iCard, pens/pencils (They provide the scratch paper)
By: Muhammad Zidny Naf’an
Bitwise Operators CS163 Fall 2018.
Pattern Matching 12/8/ :21 PM Pattern Matching Pattern Matching
Pattern Matching 1/14/2019 8:30 AM Pattern Matching Pattern Matching.
KMP String Matching Donald Knuth Jim H. Morris Vaughan Pratt 1997.
Pattern Matching 2/15/2019 6:17 PM Pattern Matching Pattern Matching.
ECE 352 Digital System Fundamentals
Bitwise Operators.
Pattern Matching Pattern Matching 5/1/2019 3:53 PM Spring 2007
Pattern Matching 4/27/2019 1:16 AM Pattern Matching Pattern Matching
ECE 120 Midterm 1 HKN Review Session.
Presentation transcript:

Happy Birthday Julia Courier New

USACO December Contest - Congratulations to Jon+Julia+Andy for promoting to gold And Johnny - 2th place in gold among US competitors with 2- letter-long last names. Steven beat Johnny January Contest - today is last day take it guise o potw points

Bitmasks First: bitwise operations XOR, AND, OR example: a = 18, b = 14. a ^ b = ???? a :10010 b :01110 a ^ b:11100 a | b:11110 a & b:00010

More Bitwise Operations Shift left, Shift right x = 13 x: x >> 1: x >> 2: x >> 3: x >> 4: x << 1: x << 2: x << 3: x << 4:

What's the point?? Compute the i-th bit of an int. Ex: x = 69 x: ^ 0'th bit. i'th bit of x is (x >> i) & 1 in general, x & 1 isolates its 0'th (least significant) bit. equiv. to x % 2 but faster Now we can treat an int like we do a bool array!! When we use an int like this, it's called a BITMASK!!

BITMASK what's the point?? 1) Saves memory 2) Can be indexed in an array - USEFUL WHEN DOING DP 3) Can be easily incremented; iterating a bitmask from 0 to (1 << n) generates all 2^n possible "bool arrays of length n" this can let you iterate over all subsets of a set easily - just one for loop!! also use 1 << x to calculate the x'th powers of 2 quickly.

BITMASK i & -i gives you the least significant set bit: i: i: i&-i: This is because -i = ~i + 1, where ~ flips all bits ~i: ~i+1:

POTW Given a set of N binary strings with length less than or equal to 5, find the shortest binary string that contains all of them as substrings. Sample Input Sample Output: 01110

POTW Bounds 25 pts (apply brute force): N <= 4 35 pts (optimized brute force): N <= 8 45 pts (apply bitmask dp): N <= 16