Strings. Piech, CS106A, Stanford University
|
|
- George Gilmore
- 5 years ago
- Views:
Transcription
1 Strngs
2 Learnng Goals 1. Understand chars and Strngs 2. Wrte methods actng on Strngs
3 Text Applcatons
4 ow s text represented?
5 The varable type Strng Text s stored usng the varable type Strng. A Strng s a sequence of characters. publc vod run() { Strng text = hello! ; prntln(text);
6 e l l o!
7 e l l o!
8 e l l o! text.charat(ndex)
9 All characters n a strng have an ndex. You can access a character n the sequence va ts ndex
10 Strng Methods l l The strng.length() method returns the number of characters n the strng. Ths s one larger than the last vald ndex n the strng. the strng.charat() method returns the character at a gven ndex. m o m (length )
11 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frst = example.charat(0); prntln(frst); // prnts // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch);
12 Strng Methods publc vod run() { Strng example = " mom"; Console // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frst = example.charat(0); prntln(frst); // prnts // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch);
13 Strng Methods publc vod run() { Strng example = " mom"; Console // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frst = example.charat(0); prntln(frst); // prnts // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m
14 Strng Methods publc vod run() { Strng example = " mom"; Console // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frst = example.charat(0); prntln(frst); // prnts // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length m o m
15 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frst = example.charat(0); prntln(frst); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length m o m
16 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frst = example.charat(0); prntln(frst); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst
17 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frst = example.charat(0); prntln(frst); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst
18 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frst = example.charat(0); prntln(frst); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst
19 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst
20 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst
21 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
22 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst ch m o m
23 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m ch
24 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
25 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
26 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
27 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
28 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m ch
29 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m ch
30 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
31 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
32 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
33 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m
34 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m ch
35 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m ch
36 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts Console // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example length frst m o m ch
37 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst m o m 5 Console ch m
38 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst m o m 5 Console
39 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst m o m Console
40 Strng Methods publc vod run() { Strng example = " mom"; // example of length method nt length = example.length(); prntln(length); // prnts // example of getcharat char frstletter = example.charat(0); prntln(frstletter); // prnts // loop that prnts letters one-by-one for(nt = 0; < example.length(); ++) { char ch = example.charat(); prntln(ch); example m o m length frst m o m Console
41 ow are characters represented?
42 The varable type char l l The prmtve type char represents a sngle character or glyph. Some examples: char lettera = 'A'; char plus = '+' char zero = '0'; char space = ' '; char newlne = '\n'; // specal char frst = text.charat(0);
43 ASCII * Ths s only the frst half of the table The letter A, for example, has the ASCII value 5 Usng portons of sldes by Erc Roberts
44 A -> Z are sequental. a -> z are sequental. 0 -> 9 are sequental.
45 Useful Character methods publc vod run() { Strng str = readlne("lne: "); char ch = str.charat(0); prntln("orgnal frst char: " + ch); ch = Character.toUpperCase(ch); prntln("uppercase frst char: " + ch); f(character.sletter(ch)) { prntln("it s a letter!");
46 Character Methods
47 Useful Character methods statc boolean sdgt(char ch) Determnes f the specfed character s a dgt. statc boolean sletter(char ch) Determnes f the specfed character s a letter. statc boolean sletterordgt(char ch) Determnes f the specfed character s a letter or a dgt. statc boolean slowercase(char ch) Determnes f the specfed character s a lowercase letter. statc boolean suppercase(char ch) Determnes f the specfed character s an uppercase letter. statc boolean swhtespace(char ch) Determnes f the specfed character s whtespace (spaces and tabs). statc char tolowercase(char ch) Converts ch to ts lowercase equvalent, f any. If not, ch s returned unchanged. statc char touppercase(char ch) Converts ch to ts uppercase equvalent, f any. If not, ch s returned unchanged. Usng portons of sldes by Erc Roberts
48 Strngs have some unque propertes
49 Strngs are Immutable l Java strngs are mmutable: once a strng has been created you cannot set characters. l To change a strng: l l Create a new strng holdng the new value you want t to have va concatenaton. Reassgnng the Strng varable (that s allowed). l Important consequence: f you pass a Strng nto a method, that method cannot modfy that strng.
50 Strngs are often made through concatenaton publc vod run() { Strng s1 = Breakout"; Strng s2 = t was awesome"; Strng s3 = "I crushed " + s1 + " and " + s2; prntln(s3); I crushed Breakout and t was awesome
51 Many strng algorthms use the loop and construct pattern.
52 Reversng a Strng e l l o!
53 Reversng a Strng e l l o!
54 Reversng a Strng e l l o! e
55 Reversng a Strng e l l o! l e
56 Reversng a Strng e l l o! l l e
57 Reversng a Strng e l l o! o l l e
58 Reversng a Strng e l l o!! o l l e
59 reversestrng publc vod run() { prntln("ths program reverses a strng."); prvate Strng Strng str = readlne("enter reversestrng(strng a strng: str) "); { Strng Strng rev result = reversestrng(str); = ""; prntln(str for ( + = " 0; spelled < str.length(); backwards s ++ " + ) rev); { result = str.charat() + result; rev return result; DESSERTS str STRESSED result DESSERTS SERTS STS str STRESSED ReverseStrng Ths program reverses a strng. Enter a strng: STRESSED STRESSED spelled backwards s DESSERTS Usng portons of sldes by Erc Roberts skp smulaton
60 Useful Strng methods nt length() Returns the length of the strng char charat(nt ndex) Returns the character at the specfed ndex. Note: Strngs ndexed startng at 0. Strng substrng(nt p1, nt p2) Returns the substrng begnnng at p1 and extendng up to but not ncludng p2 Strng substrng(nt p1) Returns substrng begnnng at p1 and extendng through end of strng. boolean equals(strng s2) Returns true f strng s2 s equal to the recever strng. Ths s case senstve. nt compareto(strng s2) Returns nteger whose sgn ndcates how strngs compare n lexcographc order nt ndexof(char ch) or nt ndexof(strng s) Returns ndex of frst occurrence of the character or the strng, or -1 f not found Strng tolowercase() or Strng touppercase() Returns a lowercase or uppercase verson of the recever strng Usng portons of sldes by Erc Roberts
61 Palndrome l l A palndrome s a strng that reads the same forwards and backwards. For example: l l l l l l Abba Racecar Kayak Mr. Owl ate my metal worm. Go hang a salam! I'm a lasagna hog. Elu par cette crapule
62 Let s Code t!
63 prvate boolean spalndrome(strng orgnal) { Strng reversed = reverse(orgnal); return reversed == orgnal;
64 Use.equals to compare strngs, not ==
65 prvate boolean spalndrome(strng orgnal) { Strng reversed = reverse(orgnal); return reversed.equals(orgnal);
66 Some test cases l Let's test our program on some examples: l l l l Racecar Kayak Mr. Owl ate my metal worm. Go hang a salam! I'm a lasagna hog. l Wll t work?
67 More Palndromes ere are some palndromes n other languages: l بلح تعلق تحت قلعة حلب (Dates hang underneath a castle n alab) l 여보, 안경안보여 (oney, I can't see my glasses) l कड़क (a loud thunderous sound) l 上海自來水來自海上 (Shangha tap water orgnates from "above" the ocean) The comedan Dmtr Martn also has a routne about palndromes; check t out at
68 Stress Test A man, a plan, a caret, a ban, a myrad, a sum, a lac, a lar, a hoop, a pnt, a catalpa, a gas, an ol, a brd, a yell, a vat, a caw, a pax, a wag, a tax, a nay, a ram, a cap, a yam, a gay, a tsar, a wall, a car, a luger, a ward, a bn, a woman, a vassal, a wolf, a tuna, a nt, a pall, a fret, a watt, a bay, a daub, a tan, a cab, a datum, a gall, a hat, a tag, a zap, a say, a jaw, a lay, a wet, a gallop, a tug, a trot, a trap, a tram, a torr, a caper, a top, a tonk, a toll, a ball, a far, a sax, a mnm, a tenor, a bass, a passer, a captal, a rut, an amen, a ted, a cabal, a tang, a sun, an ass, a maw, a sag, a jam, a dam, a sub, a salt, an axon, a sal, an ad, a wad, a radan, a room, a rood, a rp, a tad, a parah, a revel, a reel, a reed, a pool, a plug, a pn, a peek, a parabola, a dog, a pat, a cud, a nu, a fan, a pal, a rum, a nod, an eta, a lag, an eel, a batk, a mug, a mot, a nap, a maxm, a mood, a leek, a grub, a gob, a gel, a drab, a ctadel, a total, a cedar, a tap, a gag, a rat, a manor, a bar, a gal, a cola, a pap, a yaw, a tab, a raj, a gab, a nag, a pagan, a bag, a jar, a bat, a way, a papa, a local, a gar, a baron, a mat, a rag, a gap, a tar, a decal, a tot, a led, a tc, a bard, a leg, a bog, a burg, a keel, a doom, a mx, a map, an atom, a gum, a kt, a baleen, a gala, a ten, a don, a mural, a pan, a faun, a ducat, a pagoda, a lob, a rap, a keep, a np, a gulp, a loop, a deer, a leer, a lever, a har, a pad, a tapr, a door, a moor, an ad, a rad, a wad, an alas, an ox, an atlas, a bus, a madam, a jag, a saw, a mass, an anus, a gnat, a lab, a cadet, an em, a natural, a tp, a caress, a pass, a baronet, a mnmax, a sar, a fall, a ballot, a knot, a pot, a rep, a carrot, a mart, a part, a tort, a gut, a poll, a gateway, a law, a jay, a sap, a zag, a tat, a hall, a gamut, a dab, a can, a tabu, a day, a batt, a waterfall, a patna, a nut, a flow, a lass, a van, a mow, a nb, a draw, a regular, a call, a war, a stay, a gam, a yap, a cam, a ray, an ax, a tag, a wax, a paw, a cat, a valley, a drb, a lon, a saga, a plat, a catnp, a pooh, a ral, a calamus, a daryman, a bater, a canal Panama!
Assignment 4. Stop by the LaIR! Stop by office hours! your section leader!
Strings Assignment 4 Assignment 4 due on Monday at 3:15PM. Recommendation: Try to get the game completed by Friday so you have time to test and add extensions by Monday. Have questions? Stop by the LaIR!
More informationGries slides on A2 function evaluate and evaluate itself are on pinned Piazza note Supplementary Material 1 is the identity of gcd because
27/02/2017 Overview references to sections in text 2 What is recursion? 7.1-7.39 slide 1-7 Base case 7.1-7.10 slide 13 How Java stack frames work 7.-7.10 slide 2-32 RECURSION (CONTINUED) Lecture 9 CS2110
More informationRECURSION (CONTINUED)
RECURSION (CONTINUED) Lecture 9 CS2110 Fall2016 Overview references to sections in text 2 What is recursion? 7.1-7.39 slide 1-7 Base case 7.1-7.10 slide 13 How Java stack frames work 7.8-7.10 slide 28-32
More informationRecursion Real Life Examples. To Understand Recursion. Recursion Real Life Examples 9/13/17. Five things RECURSION
Five things 2 Lecture 8 CS2110 Fall 2017 RECURSION Note: We ve covered almost everything in Java! Just a few more things, which will be covered from time to time. Prelim 1 is in 2 weeks (Thurs 28 September,
More informationReview from Last Time
File Processing Review from Last Time The == Operator When applied to objects, the == operator reports whether the two objects are the same object, not whether the values of those objects are equal. racecar
More informationLecture 8 CS2110 Fall 2016 RECURSION
Lecture 8 CS2110 Fall 2016 RECURSION Overview references to sections in text 2 Note: We ve covered everything in JavaSummary.pptx! What is recursion? 7.1-7.39 slide 1-7 Base case 7.1-7.10 slide 13 How
More information21/02/2018. six items RECURSION. Recursion Real Life Examples. To Understand Recursion. Recursion Real Life Examples
six items 2 Note: We ve covered almost everything in Java! Just a few more things, which will be covered from time to time. A1 grades will be made available soon. Thanks for your patience. Lecture 8 CS2110
More informationLecture 8 CS2110 Spring 2017 RECURSION
Lecture 8 CS2110 Spring 2017 RECURSION 2 Four things Note: We ve covered almost everything in JavaSummary.pptx! Recursion: 7.1-7.39 slide 1-7 Base case: 7.1-7.10 slide 13 How Java stack frames work 7.8-7.10
More informationLecture 8 CS2110 Spring 2018 RECURSION
Lecture 8 CS2110 Spring 2018 RECURSION six items 2 Note: We ve covered almost everything in Java! Just a few more things, which will be covered from time to time. Prelim 1 is in 3 weeks (Tues, 13 March,
More informationLecture 8 CS2110 Fall 2018 RECURSION
Lecture 8 CS2110 Fall 2018 RECURSION five items 2 Note: We ve covered almost everything in Java! Just a few more things, which will be covered from time to time. Remember to look at the exams page of course
More informationAssignment 2. Number of Students Time Spent (hours) Piech, CS106A, Stanford University
Learn by Doing Number of Students 35 30 25 20 15 10 5 0 Assignment 2 0 2 4 6 8 10 12 14 16 18 20 22 24 Time Spent (hours) Learning to Program on the Internet Task Almost a hundred thousand unique solutions
More informationIt s turtles all the way down RECURSION
It s turtles all the way down RECURSION Lecture 8 CS2110 Spring 2019 Recursion: Look at Java Hypertext entry recursion. 2 We ve covered almost everything in Java! Just a few more things to introduce, which
More informationAn Interesting Article. How Revolutionary Tools Cracked a 1700s Code.
Manipulating Text An Interesting Article How Revolutionary Tools Cracked a 1700s Code http://www.nytimes.com/2011/10/25/science/25code.html Announcements Breakout! due this Friday at 3:15PM. Stop by the
More informationTerminal Window. 11. Section 7 Exercises Program Memory Exercise 7-1 Swap Values in an Array Working memory Global Memory. 2 nd call 3 rd call
11. Secton 7 Exercses Program Memory Exercse 7-1 Swap Values n an Array Workng memory Global Memory class SwapTlYouDrop publc statc vod man (Strng args[ ]) nt = 0; nt a; a = new nt[] 2, 4, 6, 8, 10, 12
More informationOutline. CIS 110: Introduction to Computer Programming. Review: Interactive Sum. More Cumulative Algorithms. Interactive Sum Trace (2)
Outlne CIS 110: Introducton to Computer Programmng More on Cumulatve Algorthms Processng Text Tacklng Programmng Problems Lecture 11 Text Processng and More On Desgn ( 4.2-4.3) 10/17/2011 CIS 110 (11fa)
More informationCS 106A, Lecture 9 Problem-Solving with Strings
CS 106A, Lecture 9 Problem-Solving with Strings suggested reading: Java Ch. 8.5 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5
More informationPass by Reference vs. Pass by Value
Pass by Reference vs. Pass by Value Most methods are passed arguments when they are called. An argument may be a constant or a varable. For example, n the expresson Math.sqrt(33) the constant 33 s passed
More informationNews. Recap: While Loop Example. Reading. Recap: Do Loop Example. Recap: For Loop Example
Unversty of Brtsh Columba CPSC, Intro to Computaton Jan-Apr Tamara Munzner News Assgnment correctons to ASCIIArtste.java posted defntely read WebCT bboards Arrays Lecture, Tue Feb based on sldes by Kurt
More informationUtility Functions. 3.1 Introduction
3 Utility Functions 3.1 Introduction Solaris provides a large number of utility functions that we can use in our programs, many of which will be familiar to experienced C programmers (even those who don
More informationCS 106A, Lecture 9 Problem-Solving with Strings
CS 106A, Lecture 9 Problem-Solving with Strings suggested reading: Java Ch. 8.5 This document is copyright (C) Stanford Computer Science and Marty Stepp, licensed under Creative Commons Attribution 2.5
More informationTable of Contents. Phonics
Teacher Workbooks Language Arts Series Alphabetization Skills, Volume 1 Copyright 2006 Teachnology Publishing Company A Division of Teachnology, Inc. For additional information, visit us at www.teachnologypublishing.com
More informationAnswer Key: Let s Go Phonics Book 1
Answer Key: Let s Go Phonics Book 1 The Alphabet (pages 2-8) Students write the capital and lowercase letters of the alphabet on the appropriate lines. Unit 1: b and p (pages 9-11) Let s Learn (page 9)
More informationSequential search. Building Java Programs Chapter 13. Sequential search. Sequential search
Sequental search Buldng Java Programs Chapter 13 Searchng and Sortng sequental search: Locates a target value n an array/lst by examnng each element from start to fnsh. How many elements wll t need to
More informationMidterms Save the Dates!
Unversty of Brtsh Columba CPSC, Intro to Computaton Alan J. Hu Readngs Ths Week: Ch 6 (Ch 7 n old 2 nd ed). (Remnder: Readngs are absolutely vtal for learnng ths stuff!) Thnkng About Loops Lecture 9 Some
More informationOverview. CSC 2400: Computer Systems. Pointers in C. Pointers - Variables that hold memory addresses - Using pointers to do call-by-reference in C
CSC 2400: Comuter Systems Ponters n C Overvew Ponters - Varables that hold memory addresses - Usng onters to do call-by-reference n C Ponters vs. Arrays - Array names are constant onters Ponters and Strngs
More informationPriority queues and heaps Professors Clark F. Olson and Carol Zander
Prorty queues and eaps Professors Clark F. Olson and Carol Zander Prorty queues A common abstract data type (ADT) n computer scence s te prorty queue. As you mgt expect from te name, eac tem n te prorty
More informationProgramming in Fortran 90 : 2017/2018
Programmng n Fortran 90 : 2017/2018 Programmng n Fortran 90 : 2017/2018 Exercse 1 : Evaluaton of functon dependng on nput Wrte a program who evaluate the functon f (x,y) for any two user specfed values
More informationCSCI 104 Sorting Algorithms. Mark Redekopp David Kempe
CSCI 104 Sortng Algorthms Mark Redekopp Davd Kempe Algorthm Effcency SORTING 2 Sortng If we have an unordered lst, sequental search becomes our only choce If we wll perform a lot of searches t may be benefcal
More informationA Taste of Java and Object-Oriented Programming
Introducn Computer Scence Shm Schocken IDC Herzlya Lecture 1-2: Lecture 1-2: A Taste Java Object-Orented Programmng A Taste Java OO programmng, Shm Schocken, IDC Herzlya, www.ntro2cs.com slde 1 Lecture
More informationFor instance, ; the five basic number-sets are increasingly more n A B & B A A = B (1)
Secton 1.2 Subsets and the Boolean operatons on sets If every element of the set A s an element of the set B, we say that A s a subset of B, or that A s contaned n B, or that B contans A, and we wrte A
More informationProgramming Lecture 9
Programming Lecture 9 Strings and Characters (Chapter 8) Enumeration ASCII / Unicode, special characters Character class Character arithmetic Strings vs. characters String methods Top-Down design StringTokenizer
More informationGrammars & Parsing. Lecture 12 CS 2112 Fall 2018
Grammars & Parsing Lecture 12 CS 2112 Fall 2018 Motivation The cat ate the rat. The cat ate the rat slowly. The small cat ate the big rat slowly. The small cat ate the big rat on the mat slowly. The small
More informationREFRACTION. a. To study the refraction of light from plane surfaces. b. To determine the index of refraction for Acrylic and Water.
Purpose Theory REFRACTION a. To study the refracton of lght from plane surfaces. b. To determne the ndex of refracton for Acrylc and Water. When a ray of lght passes from one medum nto another one of dfferent
More informationHigh level vs Low Level. What is a Computer Program? What does gcc do for you? Program = Instructions + Data. Basic Computer Organization
What s a Computer Program? Descrpton of algorthms and data structures to acheve a specfc ojectve Could e done n any language, even a natural language lke Englsh Programmng language: A Standard notaton
More informationToday s Outline. Sorting: The Big Picture. Why Sort? Selection Sort: Idea. Insertion Sort: Idea. Sorting Chapter 7 in Weiss.
Today s Outlne Sortng Chapter 7 n Wess CSE 26 Data Structures Ruth Anderson Announcements Wrtten Homework #6 due Frday 2/26 at the begnnng of lecture Proect Code due Mon March 1 by 11pm Today s Topcs:
More informationCMPS 10 Introduction to Computer Science Lecture Notes
CPS 0 Introducton to Computer Scence Lecture Notes Chapter : Algorthm Desgn How should we present algorthms? Natural languages lke Englsh, Spansh, or French whch are rch n nterpretaton and meanng are not
More informationThis chapter discusses aspects of heat conduction. The equilibrium heat conduction on a rod. In this chapter, Arrays will be discussed.
1 Heat Flow n a Rod Ths chapter dscusses aspects of heat conducton. The equlbrum heat conducton on a rod. In ths chapter, Arrays wll be dscussed. Arrays provde a mechansm for declarng and accessng several
More informationProgramming Lecture 9
Programming Lecture 9 Strings and Characters (Chapter 8) Enumeration ASCII / Unicode, special characters Character class Character arithmetic Strings vs. characters String methods Splitting a string into
More informationR s s f. m y s. SPH3UW Unit 7.3 Spherical Concave Mirrors Page 1 of 12. Notes
SPH3UW Unt 7.3 Sphercal Concave Mrrors Page 1 of 1 Notes Physcs Tool box Concave Mrror If the reflectng surface takes place on the nner surface of the sphercal shape so that the centre of the mrror bulges
More informationLoop Transformations, Dependences, and Parallelization
Loop Transformatons, Dependences, and Parallelzaton Announcements Mdterm s Frday from 3-4:15 n ths room Today Semester long project Data dependence recap Parallelsm and storage tradeoff Scalar expanson
More informationIntro. Iterators. 1. Access
Intro Ths mornng I d lke to talk a lttle bt about s and s. We wll start out wth smlartes and dfferences, then we wll see how to draw them n envronment dagrams, and we wll fnsh wth some examples. Happy
More informationAP CSA 3rd Period MR. D. Course Map
AP CSA 3rd Period MR. D. Course Map AP Computer Science in Java (Mocha) Aug. 10, Aug. 11, Aug. 14, Aug. 15, 1.1.1 Introduction to With Karel 1.1.2 Quiz: Karel Commands 1.1.3 Our First Karel Program 1.1.4
More informationFinal Exam. CSE Section M, Winter p. 1 of 16. Family Name: Given Name(s): Student Number:
Fna Exam CSE 1020 3.0 Secton M, Wnter 2010 p. 1 o 16 Famy Name: Gven Name(s): Student Numer: Gudenes and Instructons: 1. Ths s a 90-mnute exam. You can use the textook, ut no eectronc ads such as cacuators,
More informationSTREAM EDITOR - REGULAR EXPRESSIONS
STREAM EDITOR - REGULAR EXPRESSIONS http://www.tutorialspoint.com/sed/sed_regular_expressions.htm Copyright tutorialspoint.com It is the regular expressions that make SED powerful and efficient. A number
More informationkccvoip.com basic voip training NAT/PAT extract 2008
kccvop.com basc vop tranng NAT/PAT extract 28 As we have seen n the prevous sldes, SIP and H2 both use addressng nsde ther packets to rely nformaton. Thnk of an envelope where we place the addresses of
More informationOutline. CIS 110: Intro to Computer Programming. What Do Our Programs Look Like? The Scanner Object. CIS 110 (11fa) - University of Pennsylvania 1
Outlne CIS 110: Intro to Computer Programmng The Scanner Object Introducng Condtonal Statements Cumulatve Algorthms Lecture 10 Interacton and Condtonals ( 3.3, 4.1-4.2) 10/15/2011 CIS 110 (11fa) - Unversty
More informationCISC-124. Dog.java looks like this. I have added some explanatory comments in the code, and more explanation after the code listing.
CISC-124 20180115 20180116 20180118 We continued our introductory exploration of Java and object-oriented programming by looking at a program that uses two classes. We created a Java file Dog.java and
More informationAssignment # 2. Farrukh Jabeen Algorithms 510 Assignment #2 Due Date: June 15, 2009.
Farrukh Jabeen Algorthms 51 Assgnment #2 Due Date: June 15, 29. Assgnment # 2 Chapter 3 Dscrete Fourer Transforms Implement the FFT for the DFT. Descrbed n sectons 3.1 and 3.2. Delverables: 1. Concse descrpton
More informationCSE 326: Data Structures Quicksort Comparison Sorting Bound
CSE 326: Data Structures Qucksort Comparson Sortng Bound Bran Curless Sprng 2008 Announcements (5/14/08) Homework due at begnnng of class on Frday. Secton tomorrow: Graded homeworks returned More dscusson
More informationProblem Set 3 Solutions
Introducton to Algorthms October 4, 2002 Massachusetts Insttute of Technology 6046J/18410J Professors Erk Demane and Shaf Goldwasser Handout 14 Problem Set 3 Solutons (Exercses were not to be turned n,
More informationAssembler. Building a Modern Computer From First Principles.
Assembler Buldng a Modern Computer From Frst Prncples www.nand2tetrs.org Elements of Computng Systems, Nsan & Schocken, MIT Press, www.nand2tetrs.org, Chapter 6: Assembler slde Where we are at: Human Thought
More informationPHONOLOGICAL AWARENESS SCREENER. b. Final Sound Isolation 4/5. b. Final Sound Addition 3/4. a. Initial Sound Deletion 4/5. b. Final Sound Deletion 4/5
Student Teacher School Year PHONOLOGICAL AWARENESS SCREENER 1. Words in a Sentence 4/5 2. Syllables 4/5 3. Onset/Rime Rhyming 4/5 4. Phoneme Isolation a. Initial Sound Isolation 4/5 b. Final Sound Isolation
More information"Hello" " This " + "is String " + "concatenation"
Strings About Strings Strings are objects, but there is a special syntax for writing String literals: "Hello" Strings, unlike most other objects, have a defined operation (as opposed to a method): " This
More informationAP PHYSICS B 2008 SCORING GUIDELINES
AP PHYSICS B 2008 SCORING GUIDELINES General Notes About 2008 AP Physcs Scorng Gudelnes 1. The solutons contan the most common method of solvng the free-response questons and the allocaton of ponts for
More informationData Structures. Algorithms
Data Structures Algorithms Types of Data Structures Organize data to make access / processing fast Speed depends on the internal organization Internal organization allows different types of accesses Problems:
More informationSorting Review. Sorting. Comparison Sorting. CSE 680 Prof. Roger Crawfis. Assumptions
Sortng Revew Introducton to Algorthms Qucksort CSE 680 Prof. Roger Crawfs Inserton Sort T(n) = Θ(n 2 ) In-place Merge Sort T(n) = Θ(n lg(n)) Not n-place Selecton Sort (from homework) T(n) = Θ(n 2 ) In-place
More informationCourse Introduction. Algorithm 8/31/2017. COSC 320 Advanced Data Structures and Algorithms. COSC 320 Advanced Data Structures and Algorithms
Course Introducton Course Topcs Exams, abs, Proects A quc loo at a few algorthms 1 Advanced Data Structures and Algorthms Descrpton: We are gong to dscuss algorthm complexty analyss, algorthm desgn technques
More informationindex.pdf March 20,
ndex.pdf March 20, 20 ITI 2. Introducton to omputng II Impementaton -2-: usng an nner cass We use an nner cass to create the terators: Marce Turcotte Schoo of Informaton Technoogy and Engneerng Iterator
More informationStrings. Strings and their methods. Mairead Meagher Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics
Strings Strings and their methods Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list Primitive Types: char Object Types: String Primitive
More informationHarvard University CS 101 Fall 2005, Shimon Schocken. Assembler. Elements of Computing Systems 1 Assembler (Ch. 6)
Harvard Unversty CS 101 Fall 2005, Shmon Schocken Assembler Elements of Computng Systems 1 Assembler (Ch. 6) Why care about assemblers? Because Assemblers employ some nfty trcks Assemblers are the frst
More informationS AMPLE CHAPTER. Kenneth A. Kousen. FOREWORD BY Guillaume Laforge MANNING
S AMPLE CHAPTER Kenneth A. Kousen FOREWORD BY Guillaume Laforge MANNING Making Java Groovy by Kenneth A. Kousen Chapter 6 Copyright 2014 Manning Publications brief contents PART 1 UP TO SPEED WITH GROOVY...1
More informationColor, Cut & Glue Letter Pages
Color, Cut & Glue Letter Pages Subscriber Freebie Thank you for respecting my Terms of Use! YOU MAY use this file for your own personal, non-commercial use. YOU MAY download this file by visiting https://www.themeasuredmom.com.
More informationCS1100 Introduction to Programming
Factoral (n) Recursve Program fact(n) = n*fact(n-) CS00 Introducton to Programmng Recurson and Sortng Madhu Mutyam Department of Computer Scence and Engneerng Indan Insttute of Technology Madras nt fact
More informationTagProp: Discriminative Metric Learning in Nearest Neighbor Models for Image Auto-Annotation
TagProp: Discriminative Metric Learning in Nearest Neighbor Models for Image Auto-Annotation M. Guillaumin, T. Mensink, J. Verbeek and C. Schmid LEAR team, INRIA Rhône-Alpes, France Supplementary Material
More informationPolyhedral Compilation Foundations
Polyhedral Complaton Foundatons Lous-Noël Pouchet pouchet@cse.oho-state.edu Dept. of Computer Scence and Engneerng, the Oho State Unversty Feb 8, 200 888., Class # Introducton: Polyhedral Complaton Foundatons
More informationAMath 483/583 Lecture 21 May 13, Notes: Notes: Jacobi iteration. Notes: Jacobi with OpenMP coarse grain
AMath 483/583 Lecture 21 May 13, 2011 Today: OpenMP and MPI versons of Jacob teraton Gauss-Sedel and SOR teratve methods Next week: More MPI Debuggng and totalvew GPU computng Read: Class notes and references
More informationMore non-primitive types Lesson 06
CSC110 2.0 Object Oriented Programming Ms. Gnanakanthi Makalanda Dept. of Computer Science University of Sri Jayewardenepura More non-primitive types Lesson 06 1 2 Outline 1. Two-dimensional arrays 2.
More informationParallel Numerics. 1 Preconditioning & Iterative Solvers (From 2016)
Technsche Unverstät München WSe 6/7 Insttut für Informatk Prof. Dr. Thomas Huckle Dpl.-Math. Benjamn Uekermann Parallel Numercs Exercse : Prevous Exam Questons Precondtonng & Iteratve Solvers (From 6)
More informationStrings. Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects.
Strings Strings, which are widely used in Java programming, are a sequence of characters. In the Java programming language, strings are objects. The Java platform provides the String class to create and
More informationNachos Project 3. Speaker: Sheng-Wei Cheng 2010/12/16
Nachos Project Speaker: Sheng-We Cheng //6 Agenda Motvaton User Programs n Nachos Related Nachos Code for User Programs Project Assgnment Bonus Submsson Agenda Motvaton User Programs n Nachos Related Nachos
More informationNotes on Organizing Java Code: Packages, Visibility, and Scope
Notes on Organzng Java Code: Packages, Vsblty, and Scope CS 112 Wayne Snyder Java programmng n large measure s a process of defnng enttes (.e., packages, classes, methods, or felds) by name and then usng
More informationLecture 3: Computer Arithmetic: Multiplication and Division
8-447 Lecture 3: Computer Arthmetc: Multplcaton and Dvson James C. Hoe Dept of ECE, CMU January 26, 29 S 9 L3- Announcements: Handout survey due Lab partner?? Read P&H Ch 3 Read IEEE 754-985 Handouts:
More informationELEC 377 Operating Systems. Week 6 Class 3
ELEC 377 Operatng Systems Week 6 Class 3 Last Class Memory Management Memory Pagng Pagng Structure ELEC 377 Operatng Systems Today Pagng Szes Vrtual Memory Concept Demand Pagng ELEC 377 Operatng Systems
More informationSI485i : NLP. Set 5 Using Naïve Bayes
SI485 : NL Set 5 Usng Naïve Baes Motvaton We want to predct somethng. We have some text related to ths somethng. somethng = target label text = text features Gven, what s the most probable? Motvaton: Author
More informationVirtual Memory. Background. No. 10. Virtual Memory: concept. Logical Memory Space (review) Demand Paging(1) Virtual Memory
Background EECS. Operatng System Fundamentals No. Vrtual Memory Prof. Hu Jang Department of Electrcal Engneerng and Computer Scence, York Unversty Memory-management methods normally requres the entre process
More informationPython allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:
1 STRINGS Objectives: How text data is internally represented as a string Accessing individual characters by a positive or negative index String slices Operations on strings: concatenation, comparison,
More informationInstruction Manual for BE-SP3 Circuit. 10/21/07
Page 1 of 54 Instruction Manual for BE-SP3 Circuit. 10/21/07 Page 1 Index: Page 2 BE-SP3 Circuit Specifications. Page 3-4 Intro to the BE-SP3. Page 5 Basics of serial to parallel. Page 6-7 ASCII Code.
More informationCS107, Lecture 4 C Strings
CS107, Lecture 4 C Strings Reading: K&R (1.9, 5.5, Appendix B3) or Essential C section 3 This document is copyright (C) Stanford Computer Science and Nick Troccoli, licensed under Creative Commons Attribution
More informationAn Optimal Algorithm for Prufer Codes *
J. Software Engneerng & Applcatons, 2009, 2: 111-115 do:10.4236/jsea.2009.22016 Publshed Onlne July 2009 (www.scrp.org/journal/jsea) An Optmal Algorthm for Prufer Codes * Xaodong Wang 1, 2, Le Wang 3,
More informationCHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vidyanagar
CHARUTAR VIDYA MANDAL S SEMCOM Vallabh Vdyanagar Faculty Name: Am D. Trved Class: SYBCA Subject: US03CBCA03 (Advanced Data & Fle Structure) *UNIT 1 (ARRAYS AND TREES) **INTRODUCTION TO ARRAYS If we want
More informationIntroduction to Arrays
Introduction to Arrays CSC 1051 Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website: www.csc.villanova.edu/~map/1051/ Some
More informationSupport Vector Machines. CS534 - Machine Learning
Support Vector Machnes CS534 - Machne Learnng Perceptron Revsted: Lnear Separators Bnar classfcaton can be veed as the task of separatng classes n feature space: b > 0 b 0 b < 0 f() sgn( b) Lnear Separators
More informationBIG SOUND BUILT TOUGH WATERPROOF. 3ft WATERPROOF WIRELESS SPEAKER. 3ft I CAN FLOAT IPX7 CERTIFIED
G-DROP WATERPROOF WIRELESS SPEAKER WATERPROOF DROP ME IN THE POOL, I LL FLOAT. GET ME DIRTY, JUST HOSE ME OFF. SURF WITH ME, I LL HANG TEN. LEAVE ME OUT IN THE RAIN, I LL KEEP TRUCKIN. I CAN FLOAT 3ft
More informationParts Manual Kleen Sweep 32R Rider Sweeper
Parts Manual Kleen Sweep 32R Page 2 Table of Contents Side broom R.H., part 1... Side broom R.H., part 2... Front wheel drive... Accelerator... Steering... Seat group... Group of main sweeper roller, part
More informationLESSON 15: BODE PLOTS OF TRANSFER FUNCTIONS
10/8/015 1 LESSON 15: BODE PLOTS OF TRANSFER FUNCTIONS ET 438a Automatc Control Systems Technology Learnng Objectves After ths presentaton you wll be able to: Compute the magntude of a transfer functon
More informationCSC 222: Object-Oriented Programming. Spring 2017
CSC 222: Object-Oriented Programming Spring 2017 Simulations & library classes HW3: RouletteWheel, RouletteGame, RouletteTester javadoc java.lang classes: String, Character, Integer java.util.random for
More informationAlgorithm To Convert A Decimal To A Fraction
Algorthm To Convert A ecmal To A Fracton by John Kennedy Mathematcs epartment Santa Monca College 1900 Pco Blvd. Santa Monca, CA 90405 jrkennedy6@gmal.com Except for ths comment explanng that t s blank
More informationDIGITAL OBSERVATION GUARD LOW PROFILE PAN TILT KIT USER MANUAL
DIGITAL OBSERVATION GUARD LOW PROFILE PAN TILT KIT USER MANUAL Version 2.1 June 4, 2013 0 Table of Contents Low Profile Pan Tilt Kit Description... 3 Low Profile Pan Tilt Unit Basic Operation... 4 Mounting
More informationMachine Learning. Topic 6: Clustering
Machne Learnng Topc 6: lusterng lusterng Groupng data nto (hopefully useful) sets. Thngs on the left Thngs on the rght Applcatons of lusterng Hypothess Generaton lusters mght suggest natural groups. Hypothess
More informationSupport Vector Machines
/9/207 MIST.6060 Busness Intellgence and Data Mnng What are Support Vector Machnes? Support Vector Machnes Support Vector Machnes (SVMs) are supervsed learnng technques that analyze data and recognze patterns.
More informationCSE 326: Data Structures Quicksort Comparison Sorting Bound
CSE 326: Data Structures Qucksort Comparson Sortng Bound Steve Setz Wnter 2009 Qucksort Qucksort uses a dvde and conquer strategy, but does not requre the O(N) extra space that MergeSort does. Here s the
More informationCS107 Spring 2019, Lecture 4 C Strings
CS107 Spring 2019, Lecture 4 C Strings Reading: K&R (1.9, 5.5, Appendix B3) or Essential C section 3 This document is copyright (C) Stanford Computer Science and Nick Troccoli, licensed under Creative
More informationStrings. Strings and their methods. Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics
Strings Strings and their methods Produced by: Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list Primitive Types: char Object Types: String Primitive vs Object Types
More informationSearching & Sorting. Definitions of Search and Sort. Linear Search in C++ Linear Search. Week 11. index to the item, or -1 if not found.
Searchng & Sortng Wee 11 Gadds: 8, 19.6,19.8 CS 5301 Sprng 2014 Jll Seaman 1 Defntons of Search and Sort Search: fnd a gven tem n a lst, return the ndex to the tem, or -1 f not found. Sort: rearrange the
More informationArray transposition in CUDA shared memory
Array transposton n CUDA shared memory Mke Gles February 19, 2014 Abstract Ths short note s nspred by some code wrtten by Jeremy Appleyard for the transposton of data through shared memory. I had some
More informationParts Diagrams and Lists
SC351 Parts Diagrams and Lists www.crescentindustrial.co.uk TABLE OF CONTENTS GENERAL VIEW 1 COVER AND TANKS 3 FRAME SYSTEM 5 HANDLE SUPPORT SYSTEM 7 HANDLE SYSTEM 9 MOTOR AND DECK SYSTEM 13 BRUSH DECK
More informationEng. Mohammed Abdualal
Islamic University of Gaza Faculty of Engineering Computer Engineering Department Computer Programming Lab (ECOM 2114) Created by Eng: Mohammed Alokshiya Modified by Eng: Mohammed Abdualal Lab 4 Characters
More informationCSC 222: Object-Oriented Programming. Spring 2013
CSC 222: Object-Oriented Programming Spring 2013 Simulations & library classes HW3: RouletteWheel, RouletteGame, RouletteTester javadoc java.lang classes: String, Character, Integer java.util.random for
More informationAssoc. Prof. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Marenglen Biba (C) 2010 Pearson Education, Inc. All This chapter discusses class String, from the java.lang package. These classes provide the foundation for string and character manipulation
More informationMachine Learning: Algorithms and Applications
14/05/1 Machne Learnng: Algorthms and Applcatons Florano Zn Free Unversty of Bozen-Bolzano Faculty of Computer Scence Academc Year 011-01 Lecture 10: 14 May 01 Unsupervsed Learnng cont Sldes courtesy of
More information