12 Pages

L09

Course: CPSC 233, Fall 2009
School: Wilfrid Laurier
Rating:
 
 
 
 
 

Word Count: 545

Document Preview

nter Poi s 1 Conver t to Recur si ve Functi on i nt sum(i nt[] nums, i nt si ze) { i nt sum = 0; for (i nt i ndex = 0; i ndex < si ze; i ndex++) { sum += nums[i ndex]; } r etur n sum; } 2 Poi nter s Addi ti onal data type Poi nts to a l ocati on i n memor y Decl ar ati on: i nt* x (poi nts a memor y l ocati on that contai ns i nt) doubl e* d (poi nts to mem l ocati on wi th a doubl e) Fr acti on*...

Register Now

Unformatted Document Excerpt

Coursehero >> Canada >> Wilfrid Laurier >> CPSC 233

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
nter Poi s 1 Conver t to Recur si ve Functi on i nt sum(i nt[] nums, i nt si ze) { i nt sum = 0; for (i nt i ndex = 0; i ndex < si ze; i ndex++) { sum += nums[i ndex]; } r etur n sum; } 2 Poi nter s Addi ti onal data type Poi nts to a l ocati on i n memor y Decl ar ati on: i nt* x (poi nts a memor y l ocati on that contai ns i nt) doubl e* d (poi nts to mem l ocati on wi th a doubl e) Fr acti on* f (poi nt to mem. l ocati on wi th Fr acti on object) Var i abl e and data ar e separ ated Getti ng poi nter to a var i abl e: & x Getti ng data poi nted to: * x 3 Exa mpl es i nt x = 7; i nt* y = & x; *y = 9 What i s the val ue of x? 4 Ar r a ys a nd poi nter s i nt nums[10] Type of nums: i nt[] or i nt* nums i s poi nti ng to the fi r st el ement 5 I ndexi ng i nto a n a r r a y Opti on 1 i nt sum(i nt* nums, i nt si ze) { i nt sum = 0; for (i nt i ndex = 0; i ndex < si ze; i ndex++) { sum = sum + nums[i ndex]; } r etur n sum; } 6 I ndexi ng i nto a n a r r a y Opti on 2 i nt sum(i nt* nums, i nt si ze) { i nt sum = 0; for (i nt count = 0; count < ze; si count++) { sum = sum + * nums; nums++; } r etur n sum; } 7 I ndexi ng i nto a n a r r a y Opti on 3 i nt sum(i nt* nums, i nt si ze) { i nt sum = 0; for (i nt i ndex = 0; i ndex < si ze; i ndex++) { sum = sum + * (nums + i ndex); } r etur n sum; } 8 H ea p ver sus Sta ck M emor y Stack M emor y Stati c M ust know at compi l e ti me how much we'l l need L i nked di r ectl y wi th a var i abl e H eap M emor y 9 Dynami c Deter mi ne at r unti me how much needed Need poi nter to heap memor y Can't be named di r ectl y Al l oca ti ng M emor y on the H ea p i nt* nums = new i nt[20]; i nt* nums = new i nt[n]; 10 M a na gi...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Wilfrid Laurier - CPSC - 233
Pointers1Convert to Recursive Functionint sum(int[] nums, int size) { int sum = 0; for (int index = 0; index &lt; size; index+) { sum += nums[index]; } return sum; }2Heap versus Stack Memory Stack Memory Heap Memory
Wilfrid Laurier - CPSC - 233
Refer enci ng a nd D efer enci ng1D er efer enci ng a Poi nter Getdata poi nted to `M ove a step for war d' Use * oper ator2Exa mpl e 1 - D er efer enci ng i nt*num = new i nt; * num = 7Variable contains address on heapOperator in
Wilfrid Laurier - CPSC - 233
ReviewP o inte rs R e c urs io n1Example 1 (Exercise R7.5)Em p lo ye e h a rry = Em p lo y e e (&quot;Ha c ke r, Ha rry &quot;, 3 5 0 0 0 ) ; Em p lo ye e b o s s = h a rry ; Em p lo ye e * p h a rry = ne w Em p lo y e e (&quot;Ha c ke r, Ha rry &quot;, 3 5 0
Wilfrid Laurier - CPSC - 233
C+ vectors1Vector class Implements a dynamic array Contains Will grow as neededArray Size Capacity2Vectors declaration #include &lt;vector&gt; Declaration CreationMust specify type to store in vector vector&lt;double&gt; marks; Use a co
Wilfrid Laurier - CPSC - 233
Coding Cycle1Coding Cycle Edit Run Compile2Identifying Errors Testing Run code to see if error exists Debugging Find cause of error3Testing Limit scope of individual test. Assume the worst Automate testing Design tests before w
Wilfrid Laurier - CPSC - 233
Designing Classes1Example C re a te a q uiz th a t a s ks th e us e r to a d d fra c tio ns . Wh a t o b je c ts d o we ne e d ?2Cohesion Eve ry th ing in th e c la s s b e lo ng s in th e c la s s Design for high coh
Wilfrid Laurier - CPSC - 233
Testing1Testing C h e c k if p ro g ra m h a s e xp e c te d b e h a vio ur Ma nua l te s ting run p ro g ra m a nd p ro vid e inp uts P a rtia lly a uto m a te d te s ting Auto m a te d te s tingR un p ro g ra m g iving
Wilfrid Laurier - CPSC - 233
Inheritance1Summary on Classes Classes Objects Constructors Destructors Instantiation of objects Objects on the heap versus objects on the stack Methods Instance Variables Scoping2Life of an Object BirthMake room Person* p = new P
Wilfrid Laurier - CPSC - 233
Name Scope1Limiting Scope of variables Lo c a l S c o p e Blo c k S c o p e C la s s S c o p e File S c o p e G lo b a l S c o p e2double balance; class BankAccount { public: BankAccount(double balance); private: double balance; }; B
Wilfrid Laurier - CPSC - 233
Files and Memory Errors1Moving around the file Sequential Access read file from beginning to end Random Access `fastforward' and `rewind'seekg(n, ios:beg) beg from beginning of file cur from current position end from end of the file
Wilfrid Laurier - CPSC - 233
Managing Memory1Common Memory Errors1. 2. 3. 4. 5. 6. 7. 8.Initialization Errors Lifetime Errors Array bound errors (buffer overflows) Object Slicing Memory Leaks Using Invalid Memory Reference (Dangling Pointer) Deleting More Than Once Deleti
Wilfrid Laurier - T - 233
Question 1 (Exercise R12.5 from Big C+ - Horstmann and Budd): Consider the linked list from this exercise in the text. (You can find the diagram with the instructions for this tutorial assignment as well for your convenience.) Draw a diagram showing
Michigan - PERSONAL - 340
Econ 340 Fall Term 2006 Review QuestionsAlan Deardorff U.S. Policies and Institutions Page 1 of 4Review Questions Lecture 8 U.S. Trade Policies and InstitutionsPart 1: Multiple ChoiceSelect the best answer of those given.1.Which of the fol
Portland - GEOG - 346
Basic vocabulary for agriculture subsistence traditional commercial modern monoculture polyculture mixed cropping agroforestry kitchen/household/dooryard gardens intensive extensive shifting, slash-burn cultivation land tenure, land holding patterns
Portland - GEOG - 346
WORLD POPULATION AND FOOD SUPPLY Geography 346U Winter 2005 Martha A. Works Department of Geography 503-725-3165 Tues-Thurs 10:00-11:50 Textbooks: Gary Peters and Robert Larkin. 2002. Population Geography: Problems, Concepts, and Prospects. Kendall H
Portland - GEOG - 346
Key Words and Concepts Final Exam Factors affecting future demand for food: How might changes in population dynamics affect food demand? Demographic factors growth rate changes in structure of population Non-demographic factors income urbanization c
Portland - GEOG - 346
Population The Census Bureau Home Page is a primary source for official social, economic, and demographic statistics of the U.S. population indexed by subject. It is as well a source of Census Bureau data maps and is linked to other population websit
Portland - GEOG - 346
WORLD POPULATION AND FOOD SUPPLY Geography 346U Spring 2007 Professor Martha A. Works Department of Geography 503-725-3165 Office Hours: Mon and Wed 11:30-1:00 and by appointment Cramer Hall 424G mworks@pdx.eduClass meeting time: 10:15-11:20 MWF P
St. Anselm - NR - 14261
Research Center Working Paper Series No. 18A Case Study of Kuwait, Nigeria, and Venezuela and the Relationship between Oil and Political Stability by Daniel Tivnan Undergraduate Major in Politics Saint Anselm College Manchester, N.H 03102-1310 Clas
Berkeley - DATA - 247388
Motif for Paired PD:GTCACGGTTGACACGGTTCTCACCGTGGACACGCCAATCACTGACTTTACGCATTTCACGCTT
N. Georgia - MJSMIT - 3585
Mr. Hernandez World History ClassDigital Media Research Project Rubric Student Name: _ Topic: _ Date: _Research Process: Gathered information from journals, books, CD-ROMs, and the internet Resources are current and reliable Extracted, synthesized,
N. Georgia - MJSMIT - 3585
Web-Based Lesson PlanLesson Plan Title: Developed by: Subject Area: Grade Level: Purpose of the Activity: Learning Objectives (include at least one Georgia Performance Standard or Georgia QCC): Lesson URL(s): Equipment Needed:Phase Changes with Sta
N. Georgia - MJSMIT - 3585
Phase Changes LabDate _Materials Needed: Baby food jar and lid, aluminum foil, scissors, masking tape, two ice cubes (small enough to fit in jar), table salt, paper towels, candle and matches. My Guess:What I Do NOT Do: Do not remove the ice f
N. Georgia - MJSMIT - 3585
Webquest EvaluationAt Education World:http:/education-world.com/a_tech/webquest_orig/webquest_orig009.shtmlI was told to use Education world to find webquests online so that children can use the Internet to complete a lesson. I thought this Webq
N. Georgia - MJSMIT - 3585
Mallory SmithCSCI 120006/15/2009Ms. Smith's 4th Period Language Arts ClassStudentFirst NameJenny Leah Brittany Oliver Class AverageBook Report98 80 70 78 82Vocab Quiz Poem Essay Total Average100 70 80 80 83 100 85 75 90 88 97 90 75 95
N. Georgia - MJSMIT - 3585
Gordon Central High SchoolStudent Council Fund-Raisers (Feb 1- Feb 28)Item Lollipops Flowers Pizza Pencils Total Before School $100.00 $175.00 $0.00 $300.00 $575.00 Lunch $25.00 $250.00 $0.00 $100.00 $375.00 After School $175.00 $75.00 $450.00 $50.
N. Georgia - MJSMIT - 3585
Group Members:Group Project Lesson PlanLesson Plan Title: Developed by: Subject Area: Grade Level: Purpose of the Activity: Learning Objectives (include at least one Georgia QCC or GPS): Life Cycles Brittany Simons, Amy Stern, and Mallory Smith. L
N. Georgia - MJSMIT - 3585
Software Evaluation Go to the website for the text, www.scsite/tdc4/ and then go to each chapter( chapters 1-8). Click on Software Corner There will be 5 or 6 descriptions of different software and a link to the company that produces the software. Go
N. Georgia - MJSMIT - 3585
Phase Changes LabDate _Materials Needed: Baby food jar and lid, aluminum foil, scissors, masking tape, two ice cubes (small enough to fit in jar), table salt, paper towels, candle and matches. My Guess:What I Do NOT Do: Do not remove the ice f
Willamette - POLI - 303
Pablo's PrioritiesThe Governor's 20052007 Biennium Budget Legislature SummaryWhat do they do? Prioritize state expenses Allocate budget funding Conduct negotiations with lobbyists Solve problems from constituentsWhere's the dilem
Willamette - POLI - 303
Oregon Youth Authority&quot;Hillcrest Youth Correctional Facility&quot;Presented by Jason Bratsouleas April 25, 2005Topics For Today. Youth Correctional Facilities Save Lives The Role of Institutions The Role of Staff The Role of Clientele Leading Ca
Willamette - POLI - 303
Breaking the Myths of Social Security and ObesityKrystle Harahttp:/www.cincypost.com/opinion/o041098.html http:/www.ssa.gov&quot;Insert up to $2 Trillion in transition costs&quot;&quot;Social Security: The Generation Graft&quot;http:/www.coxandforkum.com/archive
Willamette - POLI - 303
Playing with FireForest Management in AmericaMegan West Topics in Political Theory Spring 2005The Problem2000 was 2nd Worst Fire Season in History Mismanagement 17 Deaths Cost over $2 Billion 8.4 Million Acres BurnedHazardous Fuels
Missouri State - BIO - 121
Lab 11: Phylogenetic AnalysisObjectivesBecome familiar with basic aspects of cladistics, a method for deducing the phylogenetic relationships among organisms.BackgroundPhylogeny refers to the genealogical relationships among species. The process
FIU - GLY - 1101
GLY1101: History of LifeReview for Second Exam1About the Study Guide This study guide was prepared with the purpose of helping you in your study and preparing you to take the second exam in class. The guide is organized according to the arrange
FIU - MCB - 3010
MCB 3020 Exam KeyExam 2Summer, 20061. Any global gene regulation, we had many. Such as c-AMP controlling catabolite repression ~ 300 genes in E. coli . so that the most efficient and most energy yielding substrates for growth are used first. 2.
East Los Angeles College - MAGD - 1571
East Los Angeles College - MAGD - 1571
East Los Angeles College - MAGD - 1571
STRATEGIES IN SYNTHESISProfessor T. J. Donohoe MT 2006 6 Lectures: Tuesday at 10 am; Thursday at 9 am (weeks 6-8) DP: Lecture TheatreMonensinHO7Me Me Me O H OMe O Me H O HEtMeO H OH Me1CO2H HOOH MeKishi J. Am. Chem. Soc, 1979,
East Los Angeles College - MAGD - 1571
STRATEGIES IN SYNTHESISProfessor T. J. Donohoe MT 2004 6 Lectures: Tuesday at 10 am; Thursday at 9 am (weeks 6-8) HANDOUT BOH O O H2N OH HO O OH HO O OH OH O OH MePalytoxinOH OHOH OHOHOH OH OOH OH OH OH OHO HO N H N HOHO Me OH MeH
East Los Angeles College - MAGD - 1571
Heteroatoms in Organic ChemistrySecond YearProfessor T. J. Donohoe (lectures 1-4) HT 2006 : 8 Lectures: Thursday at 10 am (weeks 1-8) DP: Lecture Theatre HANDOUT 1: Boron Reagents in Organic SynthesisCNH 9-BBN ClCH2CN t-BuOK t-BuOHAcOAcOA
East Los Angeles College - MAGD - 1571
3/09/06P. Lindsay-ScottProblems: Synthesis of Stemona Alkaloids(1) Scheme 1 shows the synthesis of trans-pyrrolidine A, containing the core ring system common to the Stemona Alkaloids. Please give reagents for the steps marked &quot;?&quot; and mechanisms
East Los Angeles College - MAGD - 1571
Problems 10.10.06Narasaka et al, JACS, 2006, 6931Oliver WilliamsPlease provide mechanisms, and where necessary reagents and structures, for the following synthesis of (-)-SordarinOi. cat. CuBr.SMe2, TMSCl, ii. Et2Zn, CH2I2 iii. K2CO3MgBr
East Los Angeles College - MAGD - 1571
17th October 2006ProblemsFarrah1. Fill in the gaps and provide mechanisms for the synthesis of Platensimycin.OTBS i. LDA, Br O ii. LDA, Br O [CpRu(MeCN)3]PF6 (cat.) TBSO O 3 steps OEtOiii. DIBAL-H then HCl iv. TBSCl, imid., DMFAi. SmI2
East Los Angeles College - MAGD - 1571
24/20/06ProblemsJAK1. We'll start with the synthesis of Staurosporine, a glycone with an indolocarbazole central motif. Please give mechanisms and provide a structure for the second step.H N O NO2 N H O CO2Et NO2H2N CO2Et N H(i) aq. KOH (i
East Los Angeles College - MAGD - 1571
GHC - Problems Total Synthesis of (+)-Batzelladine A31/10/06Polycyclic guanidine natural products are interesting and unusual targets for total synthesis. Members of the batzelladine alkaloids, in particular, have exhibited potential antiviral an
East Los Angeles College - MAGD - 1571
TJC- Problems7-Nov-06A Feast of Problems1. The starter: Please provide mechanisms and the missing structures.O H N H NH2i. PPh3, CCl4, Et3N, MeCNAii. benzoyl chloride, CH2Cl2, then H2OC8H7N2OCliii. ZnBr2, iPr2NH CH2Cl2B2. The mai
East Los Angeles College - MAGD - 1571
Carole Bataille Problems 14/11/061 Please, provide the structures (A and B) and mechanisms.Ar Ar OTMSN HAO+OSHN HAr Ar OTMSBAr = 3,5-(CF3 )2-PhAr = 3,5-(CF3 )2-Ph10 mol% PhCO2HC13H16O2S10 mol% NaHCO3C13H16O2S2 Find the m
East Los Angeles College - MAGD - 1571
21/11/06 ProblemsMatt &amp; Adam1) ()-Hypnophilin is a sesquiterpenoid known for its antitumour activity and its ability to inhibit the growth of gram positive and gram negative bacteria, along with a wide variety of fungi and yeasts. Provide missing
East Los Angeles College - MAGD - 1571
RET Problems 28/11/061.A short indole synthesis to get started with. Mechanism please.BrCN (2 equiv.) EtOH, 45 oC 20-60 min NH2 N then NH4Cl (aq.) 1-3 hRR H HN O2. A short synthesis of duocarmycin SA. Please provide mechanisms and missing
East Los Angeles College - MAGD - 1571
Paolo InnocentiTJD GroupNovember 2006As usual, provide mechanisms, missing reagents and structures. a)O 1) 2) O O methyl acetoacetate, NaH Pd(PPh3)4, THF, 55 C MeOAF F F F O F1) 2) 3)NO1) N1) 2)1) 2) N Boc 3) 4) N BocNBoc1)
East Los Angeles College - MAGD - 1571
Paolo InnocentiTJD GroupOctober 2006Oxonia-Cope / Prins Cascade: Synthesis of Heavily Substituted TetrahydropyransThe Prins cyclisation and the oxonia-Cope rearrangement are two related processes which are initiated by an oxocarbenium ion and
East Los Angeles College - MAGD - 1571
Asymmetric route to 2,5-disubstituted pyrrolines via a double palladiumcatalysed AAA reaction - B. M. Trost.Rhian Thomas Literature 10th October, 2006. Generic palladium-catalysed asymmetric allylic alkylation (AAA) for synthesis of 5membered rings
East Los Angeles College - MAGD - 1571
Lisa Fishlock17th October 2006The Enyne-Metathesis ReactionThe enyne metathesis is a bond reorganisation of an alkene and an alkyne to produce a 1,3-diene (Scheme 1). It has been used in both intramolecular and intermolecular applications, and i
East Los Angeles College - MAGD - 1571
TJD group meeting 24/10/06David KlauberMethylenation reactionsThe transformation of carbonyl compounds to terminal olefins is an important transformation, particularly with the recent exploitation of the metathesis reaction in organic synthesis.
East Los Angeles College - MAGD - 1571
N.H. EvansLiterature Talk: Intramolecular Hydroamination of Unactivated Alkenes31/10/2006Intramolecular Hydroamination of Unactivated AlkenesNitrogen-containing heterocycles are to be found in a large number of natural products of interest. C
East Los Angeles College - MAGD - 1571
Matt Cheeseman 7/11/06Temporary Stereocentres in Asymmetric SynthesisSynthesis of chiral cyclopropane carboxaldehydesO O N Me Ph (CA) Recycle O O + O H (S) Overall Transf ormation O (CA) + H (P) O R Step 3 Ph O N Me (CA-P) R Step 1 Ph N Me (CA-S)
East Los Angeles College - MAGD - 1571
Katherine Wheelhouse14th November 2006Transformation of Primary Amines into Alternative Functional GroupsThe transformation of an alcohol into an alternative functional group is relatively facile and common in organic synthesis (via e.g. Mitsuno
East Los Angeles College - MAGD - 1571
Ftima ChurrucaLiterature21th November 2006Boronic Acid-Mannich Reaction (Petasis Reaction)The Petasis Reaction is a three-component variant of the Mannich reaction involving the condensation of an amine, aldehyde and organoboronic acid:OH R
East Los Angeles College - MAGD - 1571
Peter Lindsay-Scott28/11/06Palladium-Catalysed Synthesis of 1,2,3-Triazoles1,2,3-Triazoles display a wide spectrum of biological activity and are commonly found in pharmaceuticals. They are conventionally formed by the Huisgen dipolar cycloaddit
East Los Angeles College - MAGD - 1571
Oliver Williams Dichloromethylation activation: Methylenation and cyclopropanation.12/12/2006Methylenalytions and cyclopropanations usually use expensive or dangerous reagents such as CH2Br2 or diazomethane. Dichloromethane has never been reporte