Computer Science Club The best thing about a boolean is even if you are wrong, you are only off by a bit.

Slides:



Advertisements
Similar presentations
Computer Science Club “The computer was born to solve problems that did not exist before.” – Bill Gates.
Advertisements

Connects the people of Slave Lake to the knowledge and cultures of the world.
Lecture Computer Science I - Martin Hardwick Recursion rA recursive function must have at least two parts l A part that solves a simple case of the.
Sequence of characters Generalized form Expresses Pattern of strings in a Generalized notation.
Algorithm Design approaches Dr. Jey Veerasamy. Petrol cost minimization problem You need to go from S to T by car, spending the minimum for petrol. 2.
For(int i = 1; i
1 Directed Depth First Search Adjacency Lists A: F G B: A H C: A D D: C F E: C D G F: E: G: : H: B: I: H: F A B C G D E H I.
void count_down (int count) { for(i=count; i>1; i--) printf(" %d\t", count); } printf("A%d\n", count); if(count>1) count_down(count-1); printf("B%d\n",
Visita:
LYNBROOK COMPUTER SCIENCE CLUB MONDAY, OCTOBER 26, 2009 POWERPOINT CREATED BY: RITIK MALHOTRA PRESENTATION BY: KARTHIK VISWANATHAN Intro to USACO.
CSE 390B: Graph Algorithms Based on CSE 373 slides by Jessica Miller, Ruth Anderson 1.
(())()(()) ((())()(())()(()))
1 Depth First Search dfs(0, 0) open site blocked site reachable from top via open sites.
CS 206 Introduction to Computer Science II 11 / 07 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 11 / 10 / 2008 Instructor: Michael Eckmann.
COS 126 – Atomic Theory of Matter. Atomic Theory Overview Brownian Motion Random collision of molecules Displacement over time fits a Gaussian distribution.
COS 126 – Atomic Theory of Matter. Announcements Project – due Friday (1/12) midnight TA Office Hours this week (check website) Lab Help (Mon-Fri 7pm-9pm)
Depth-first search COMP171 Fall Graph / Slide 2 Depth-First Search (DFS) * DFS is another popular graph search strategy n Idea is similar to pre-order.
Graphs & Graph Algorithms Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
CS 206 Introduction to Computer Science II 03 / 30 / 2009 Instructor: Michael Eckmann.
Depth-First Search Lecture 24 COMP171 Fall Graph / Slide 2 Depth-First Search (DFS) * DFS is another popular graph search strategy n Idea is similar.
Week 7 - Wednesday.  What did we talk about last time?  Recursive running time  Master Theorem  Introduction to trees.
Search Related Algorithms. Graph Code Adjacency List Representation:
Computer Science Club It is easier to change the specification to fit the program than vice versa.
Section 9 Graph search algorithms. Breadth-first search Idea: Let |n| denote a distance of node n from the initial node. We visit nodes in order: All.
Where’s the title? You gotta search for it!. PotW Solution String s = new Scanner(System.in).next(); int[] prev = new int[s.length() * 2 + 2]; Arrays.fill(prev,
Breadth First Search and Depth First Search. Greatest problem in Computer Science Has lead to a lot of new ideas and data structures Search engines before.
National High School of Mathematics and Science. This is our school.
Graph Theory Def: A graph is a set of vertices and edges G={V,E} Ex. V = {a,b,c,d,e} E = {ab,bd,ad,ed,ce,cd} Note: above is a purely mathematical definition.
Visit:
亚洲的位置和范围 吉林省白城市洮北区教师进修学校 郑春艳. Q 宠宝贝神奇之旅 —— 亚洲 Q 宠快递 你在网上拍的一套物理实验器材到了。 Q 宠宝贝打电话给你: 你好,我是快递员,有你的邮件,你的收货地址上面 写的是学校地址,现在学校放假了,能把你家的具体 位置告诉我吗? 请向快递员描述自己家的详细位置!
1 A Case Study: Percolation Percolation. Pour liquid on top of some porous material. Will liquid reach the bottom? Applications. [ chemistry, materials.
2.4 A Case Study: Percolation Introduction to Programming in Java: An Interdisciplinary Approach · Robert Sedgewick and Kevin Wayne · Copyright © 2008.
Code: BCA302 Data Structures with C Prof. (Dr.) Monalisa Banerjee By.
UOP IT 205 W EEK 2 A SSIGNMENT H OW C OMPUTERS W ORK P RESENTATION C HECK THIS A+ TUTORIAL GUIDELINE AT HTTP :// WWW. ASSIGNMENTCLOUD. COM / IT -205/ IT.
UOP IT 205 W EEK 2 C HECK P OINT K EY C OMPUTER T ERMS C HECK THIS A+ TUTORIAL GUIDELINE AT HTTP :// WWW. ASSIGNMENTCLOUD. COM / IT -205/ IT WEEK.
UOP IT 241 W EEK 2 DQ 1 A ND DQ 2 C HECK THIS A+ TUTORIAL GUIDELINE AT HTTP :// WWW. ASSIGNMENTCLOUD. COM / IT -241/ IT WEEK -2- DQ -1- AND - DQ.
MGMT 410 W EEK 2 C ASE S TUDY O FF THE J OB B EHAVIORS C HECK THIS A+ TUTORIAL GUIDELINE AT HTTP :// WWW. ASSIGNMENTCLOUD. COM / MGMT -410/ MGMT -410-
ASH ACC 306 W EEK 2 A SSIGNMENT E 14-16, E 14-18, E 15-25, P14-21, P15-3 C HECK THIS A+ TUTORIAL GUIDELINE AT HTTP :// WWW. ASSIGNMENTCLOUD. COM / ACC.
EDU 626 W EEK 5 DQ 2 E VALUATION R ESEARCH C HECK THIS A+ TUTORIAL GUIDELINE AT HTTP :// WWW. ASSIGNMENTCLOUD. COM / EDU ASH / EDU WEEK -5-
BIS 219 Week 2 Individual Club IT, Part One Check this A+ tutorial guideline at 219/BIS-219-Week-2-Individual-Club-IT-Part-
BSA 310 Week 1 DQ 1 Computer business systems have been around for around years. Desktop computers have been around for about 25 years. Why do business.
Graphs Representation, BFS, DFS
Graph Traversals Some algorithms require that every vertex of a graph be visited exactly once. The order in which the vertices are visited may be important,
Bay Area Portrait Photographer -
Who can win more gold medals?
Godrej Prakriti Sodepur | Godrej Prakriti Kolkata

www 123 hp com setup hp com setup :
www 123 hp com setup hp com setup :
www 123 hp com setup hp com setup :
www 123 hp com setup hp com setup :
www 123 hp com setup hp com setup :
Giftalove Best Cake Offers
Depth First Search—Backtracking
Alyce Brady CS 470: Data Structures CS 510: Computer Algorithms
Graph Search Applications
Graphs Representation, BFS, DFS
Who can win more gold medals?
Who can win more gold medals?
Who can win more gold medals?
Graph Traversals Depth-First Traversals. Algorithms. Example.
Who can win more gold medals?
Gold Northern Region ENTRY FEES Newcastle Golf Club Ladies Champs &
Depth-First Search CSE 2011 Winter April 2019.
First Grade Unit 1 Review.
Count by 10’s, 5’s and 2’s and then fill in the missing numbers!
2.4 A Case Study: Percolation
Visit us:
Who can win more gold medals?
Presentation transcript:

Computer Science Club The best thing about a boolean is even if you are wrong, you are only off by a bit.

USACO Its over! You can find analysis and test data at ace.delos.com/OCT10B.htm (or 10S, 10G) If you missed it, go take it next weekend Nov.5-8 You can still qualify for the next division by getting ~85% Note that Gold #1 was almost the same as the problem of the week… (the knapsack one)

USACO Silver #2 Count the number of lakes Recursive flood-fill (also known as dfs or depth first search) Begin the recursion at each unvisited point Mark points visited as you visit them At each step, continue the recursion to each unvisited neighbor Each time you restart the recursion, you have found a new lake W WW.. W.W.W.....W..W.W......W...W W.

Code for Flood Fill int countlakes() { int groupc=0; for(int x=0;x<numX;x++) for(int y=0;y<numY;y++) if(!vis[x][y]) // not visited yet { dfs(x,y); // start recursion groupc++; // increment count } return groupc; }

Code for Flood Fill (cont.) int[] mx={-1,-1,-1,0,0,1,1,1}; // movement arrays int[] my={-1,0,1,-1,1,-1,0,1}; // save a lot of typing! void dfs(int x,int y) { if(x =numX || y =numY || vis[x][y]) return; // out of bounds or already visited vis[x][y]=true; // mark as visited for(int m=0;m<8;m++) // go through movement array dfs(x+mx[m],y+my[m]); // recurse }

Dijkstras Algorithm Used to find the shortest path between a starting position and destination. Given a graph with specified distances of the directional paths between nodes: Task: Find the shortest path from Node a (initial node) to Node f (destination). For example, A-C-D-F has a distance of = 15. The path A-C-E-F has a distance of = 11. Is there a path even SHORTER than that? Can you be sure your path is the shortest possible?

3 2 Dijkstras cont… The Steps Step 1: Each node has a distance value. (a = 0, others = ) Step 2: Two node sets: visited and unvisited (init: none visited) Step 3: a = curNode Step 4: (recursive step!) - Update unvisited neighbors of curNode with new shortest dist - move curNode to visited set - new curNode = smallest unvisited node

3 2 Dijkstras cont…Finishing Up When curNode = destination, shortest path = value of final node. Try to trace the algorithm and find the shortest path and minimal distance. Consider… Why dont we need to re- check visited nodes? Why cant there be a shorter path to a visited node?

REMEMBER… The first real USACO round will be this weekend! Practice with the free USACO Training lessons: Sign in! Have fun coding