# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

3 Pages

### 29S-Section-Solution

Course: CS 106B, Winter 2008
School: Stanford
Rating:

Word Count: 212

#### Document Preview

Winter CS106B 2009 Handout 29S Section Solution 6 February 18-20, 2009 Problem 1: Removing Duplicates void RemoveDuplicates(node *list) { for (node *cur = list; cur != NULL; cur = if (cur-&gt;next != NULL &amp;&amp; cur-&gt;value == node *duplicate = cur-&gt;next; cur-&gt;next = cur-&gt;next-&gt;next; delete duplicate; } } } cur-&gt;next) { cur-&gt;next-&gt;value) {...

Register Now

#### Unformatted Document Excerpt

Coursehero >> California >> Stanford >> CS 106B

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.
Winter CS106B 2009 Handout 29S Section Solution 6 February 18-20, 2009 Problem 1: Removing Duplicates void RemoveDuplicates(node *list) { for (node *cur = list; cur != NULL; cur = if (cur->next != NULL && cur->value == node *duplicate = cur->next; cur->next = cur->next->next; delete duplicate; } } } cur->next) { cur->next->value) { // match? // remember // circumvent // dispose Problem 2: Ribonucleic Acid and Codons node **ExtractCodons(string rna, int counts[]) // counts is of length 4 { node **lists = new node *[4]; for (int i = 0; i < 4; i++) { counts[i] = 0; lists[i] = NULL; } for (int i = 0; i < rna.length(); i+=3) { string codon = rna.substr(i, 3); for (int j = 0; j < codon.length(); j++) counts[CharToIndex(codon[j])]++; int index = CharToIndex(codon[0]); *n node = new node; n->codon = codon; n->next = lists[index]; lists[index] = n; } return lists; } int CharToIndex(char ch) { switch (ch) { case 'A': return 0; case 'G': return 1; case 'U': return 2; case 'C': return 3; default: Error("Unexpected character: '%c'\n", ch); } } 2 Problem 3: Separating Odds And Evens! struct node { int value; node *next; }; void SeparateOddsAndEvens(node *& list, node *& odds, node *& evens) { node **oddsp = &odds; // track the address of the original odds node **evensp = &evens; // same thing for the original evens for (node *curr = list; curr != NULL; curr = curr->next) { if (curr->value % 2 == 0) { *evensp = curr; evensp = &(curr->next); } else { *oddsp = curr; oddsp = &(curr->next); } } *oddsp = *evensp = list = NULL; }
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:

Old Dominion - ENGLISH - 12
www.GetPedia.com*More than 150,000 articles in the search database *Learn how almost everything worksEnglish Vocabulary in UseCAMBRIDGEU NIVERSITY PRESSPUBLISHED BY T H E PRESS SYNDICATE O F T H E UNIVERSITY OF CAMBRIDGET he Pitt Building, Trumpingt
Old Dominion - ENGLISH - 15
New New Headway Intermediate Testsea e a ho TeachHea tocopi lass o p da ar omfe un l, stndt a s ho iada o p da ar somfe un l, stndt a C mater tte.tion i riadati is a e c mate tte. on Casstaught an e co short staught anduexplained thoroughly, Cas rse zer
Golden West - BIOL 200 - BIOL 200
Summer 2009 Bio 200Pharmacology: An Introduction to Basic Drug GroupsCourse Objective Students will study the classication of medications and basic principles of pharmacology from legislation and pharmacokinetics through receptor theory, pharmacodynamic
Golden West - BIOL 200 - BIOL 200
DrugsofthePeripheralNervousSystemNervousSystems2DivisionsCentralBrain SpinalCordPeripheralVoluntary Involuntary AutonomicSympathetic ParasympatheticEffectorCellsofthe PeripheralNervousSystemVoluntarySkeletalMuscleAutonomicCardiacMuscle SmoothMu
Golden West - BIOL 200 - BIOL 200
Unit 10Serums, Vaccines &amp; HormonesTypes of ImmunityNatural (Inborn) ActiveMake Own AntibodiesAcquiredPassiveGiven Preformed AntibodiesExposureInjection Vaccine ToxoidMother to FetusSerums(Gamma Globulins)Diabetes Mellitus Characterized by el
Golden West - BIOL 200 - BIOL 200
Unit 9DiureticsFiltrationReabsorption Secretion ExcretionDCT: Aldosterone PCT: 100% Nutrients Reabsorbed`Clor HCO3-K+ o r H +Powerful Reabsorption: Cl- &amp; Na+Collecting Tubule: Loop of Henle:Counter Current Mechanism Sets up ability to concentrat
Golden West - BIOL 200 - BIOL 200
Unit 8Eye, Skin &amp; AntimicrobialsWide Angle1Narrow AngleThree major types of glaucoma and basic treatment: Congenital Glaucoma surgery required Primary Glaucoma Narrow angle (also called acute congestive) cause: poor drainage because of position of
Golden West - BIOL 200 - BIOL 200
Unit 7Respiratory, Antihistaminic &amp; GI DrugsAsthma: Bronchoconstriction Increased mucus productionManaging the Airway Drugs to open the airway Drugs to treat the inflammation Decrease the airway remodeling Remodeling describes the permanent, negativ
Golden West - BIOL 200 - BIOL 200
Drugs of the Central Nerous SystemStimulation Increases: Convulsions or Seizures Sensory Acuity Motor Activity Tremors &amp; Hallucinations Anxiety Euphoria Normal -Neutral Sedation (Drowsy) Hypnosis (Sleep) General Anesthesia Coma DeathDeathDepression Inh
Golden West - BIOL 200 - BIOL 200
Unit 5Drugs of the Cardiovascular SystemCardiotonic drugs Drugs that increase the strength of the heart. Drugs for a failing heart.The heart becomes weaker as a pump. Can happen over many years or rapidly in response to injury Goals for treatment: in
Golden West - BIOL 200 - BIOL 200
Lecture 2How effective is the drug at producing a pharmacologic response. How well does it relief symptoms Not concerned with how much a person needs totake to get the effectMaximum effect of the drugThe amount of the drug necessary to produce a phar
Golden West - BIOL 200 - BIOL 200
Welcome to Pharmacolgy Biology 200Petitioners will be added at the end of lectureDr. Kate EganOffice: HS 115 Phone: 714.892.7711 ext. 51125 Hours: Tuesday 2:15-3:15 / 5:30-6:30 PM Wednesday 6:00 - 7:00 PM or by appointment Email: cegan@gwc.cccd.edu Cou
Golden West - BIOL 200 - BIOL 200
PHARMACOLOGY: Homework AssignmentDue: Worth: Time:PRINT NAME:_ Three ID#:_Last Class Meeting Before Final Exam - Will not be accepted late. 5 points Do not spend more than 30 minutesUSE: DRUG FACTS AND COMPARISONS1. Use the Table of Contents of Drug
Golden West - BIOL 200 - BIOL 200
PRINT NAME: _ ID#:_ PHARMACOLOGY: HOMEWORK 2 Due: Meeting When Beginning Unit 7 - Will not be accepted late. Worth: 5 points Time: Do not spend more than 30 minutesUSE: DRUG FACTS AND COMPARISONS1. Use the Table of Contents from the front of Drug Facts
Golden West - BIOL 200 - BIOL 200
Print Name:_ Student ID #:_ Pharmacology: Homework Assignment One Due: March 4, 2009 5 pts Look up a drug of your choice in 3 a Physicians Desk Reference Book, a Drug Facts &amp; Comparisons Book and another drug reference book of your choice. Goal of the ass
Golden West - BIOL 200 - BIOL 200
Pharmacology Final Study OutlineUnit 1-3 (8) Understand Ionization and how it pertains to the movement of a drug Know the difference between potency and efficacy Review Drug Schedule/ prescription writing procedures How are drugs namedtrade names, generi
Golden West - BIOL 200 - BIOL 200
Name:_ ID #:_ Bio 200- Pharmacology Additional Extra Credit Assignment Due 5/20 NO LATE ASSIGNMENTS WILL BE ACCEPTED Write on this sheet of paper (you can use both sides if needed) Research the mechanism of action of the diuretics furosemide (Lasix) and s
Golden West - BIOL 200 - BIOL 200
Pharmacology Extra Credit AssignmentWorth 5 points Due Meeting Before Final Exam Accepted Earlier but not laterAssignment:1. Read one article in a professional journal which has been published within the past 15 months. This includes major science maga
Golden West - BIOL 200 - BIOL 200
Pharmacology Exam 3 Review (Units 6-8) Unit 6 Drugs of the CNS Memorize the Continum Chart Understand the 2 types of tolerance Factors contributing to drug dependence CNS Stimulants how do they work? What are the main types we talked about in class the ma
Golden West - BIOL 200 - BIOL 200
EXAM 2 REVIEW Unit 4 Drugs of the Peripheral Nervous System What are preganglionic and postganglionic neurons and where are they found? How many efferent neurons in the SNS, PNS, voluntary portion of the nervous system What are the main receptors we talke
Golden West - BIOL 200 - BIOL 200
Outline of Central Nervous System DrugsDirections: MEMORIZE THIS A. CNS Stimulants - increase activity of ALL parts of the CNS 1. Amphetamines and related compounds 2. Xanthines (including caffeine, theobromine, and theophylline) 3. Cocaine and related l
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 13 Convergence analysis of the barrier method complexity analysis of the barrier method convergence analysis of Newtons method choice of update parameter bound on the total number of Newton iterations initialization131Comp
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 14 Primal-dual interior-point methods primal-dual path-following Mehrotras corrector step computing the search directions141Central path and complementary slacknesss + Ax b = 0 AT z + c = 0 zisi = 1/t, z 0, i = 1, . . . ,
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 15 Self-dual formulations initialization and infeasibility detection skew-symmetric LPs homogeneous self-dual formulation self-dual formulation151Solution of an LPgiven a pair of primal and dual LPs minimize cT x subject
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 16 Large-scale linear programming cutting-plane method Benders decomposition delayed column generation Dantzig-Wolfe decomposition161Cutting-plane methodminimize cT x subject to Ax b A Rmn, m n general idea: solve sequenc
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 17 Integer linear programming integer linear programming, 0-1 linear programming a few basic facts branch-and-bound171Denitioninteger linear program (ILP) minimize cT x subject to Ax b, x ZncGx = dmixed integer linear
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 1 Introduction and overview linear programming example from optimal control example from combinatorial optimization history course topics software11Linear program (LP)nminimizej =1 ncj xj aij xj bi,j =1 nsubject toi
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 2 Linear inequalities vectors inner products and norms linear equalities and hyperplanes linear inequalities and halfspaces polyhedra21Vectors(column) vector x Rn: x1 x x = .2 . xn xi R: ith component or element of x al
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 3 Geometry of linear programming subspaces and ane sets, independent vectors matrices, range and nullspace, rank, inverse polyhedron in inequality form extreme points the optimal set of a linear program31SubspacesS Rn (S
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 4 The linear programming problem variants of the linear programming problem LP feasibility problem examples and some general applications linear-fractional programming41Variants of the linear programming problemgeneral fo
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 5 Structural optimization minimum weight truss design truss topology design limit analysis design with minimum number of bars51Truss m bars with lengths li and cross-sectional areas xi N nodes; nodes 1, . . . , n are free
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 6 FIR lter design FIR lters linear phase lter design magnitude lter design equalizer design61FIR ltersnite impulse response (FIR) lter:n1y (t) = =0h u(t ),tZ u : Z R is input signal ; y : Z R is output signal hi R a
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 7 Applications in control optimal input design robust optimal input design pole placement (with low-authority control)71Linear dynamical systemy (t) = h0u(t) + h1u(t 1) + h2u(t 2) + single input/single output: input u(t)
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 8 Network optimization network ows minimum cost network ow problem extreme ows shortest path problem bipartite matching81Networksnetwork (directed graph): m nodes connected by n directed arcs arcs are ordered pairs (i, j
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 9 Duality (part 1) the dual of an LP in inequality form weak duality examples optimality conditions and complementary slackness Farkas lemma and theorems of alternatives proof of strong duality91The dual of an LP in inequa
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 10 Duality (part 2) duality in algorithms sensitivity analysis via duality duality for general LPs examples mechanics interpretation circuits interpretation two-person zero-sum games101Duality in algorithmsmany algorithms
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 11 The simplex method extreme points adjacent extreme points one iteration of the simplex method degeneracy initialization numerical implementation111Idea of the simplex methodmove from one extreme point to an adjacent ex
Monmouth IL - CAAM - 236
EE236A (Fall 2007-08)Lecture 12 The barrier method brief history of interior-point methods Newtons method for smooth unconstrained minimization logarithmic barrier function central points, the central path the barrier method121The ellipsoid method 19
Monmouth IL - MATH - MATH427
MT 3802 NUMERICAL ANALYSIS2008/2009Dr Clare E Parnell and Dr Stphane Rgnier e eOctober 1, 2008Chapter 0Handout0.1 NotationThroughout this course we will be using scalars, vectors and matrices. It is essential that you know what they are and can tel
Monmouth IL - MATH - MATH427
MT 3802 NUMERICAL ANALYSIS2008/2009Dr Clare E Parnell and Dr Stphane Rgnier e eOctober 15, 2008Contents0 Handout 0.1 0.2 0.3 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Introduction . . . . . . . . .
Monmouth IL - MATH - MATH427
Chapter 2Iterative Methods2.1 IntroductionIn this section, we will consider three different iterative methods for solving a sets of equations. First, we consider a series of examples to illustrate iterative methods. To construct an iterative method, we
Monmouth IL - MATH - MATH427
cep 2008/09MT3802 - Numerical AnalysisSOLUTIONS - Tutorial Sheet 1 1. Show that the following satisfy the requirements of a norm specified on a Vector Space: (i)bf =a|f (x)|dxwhere f (x) C[a, b] ; Proof that is satisfies Rule 1 (1.1) f = 0 &amp; conti
Monmouth IL - MATH - MATH427
cep 2008/09MT3802 - Numerical AnalysisSOLUTIONS - Tutorial Sheet 2 1. For a sub-ordinate matrix norm and an invertible matrix A, where Ax = b, show that (i) As AssNUsing Rule 5 (1.9) of sub-ordinate matrix norms we have As A As-1 A2As-2 As-1A As
Monmouth IL - MATH - MATH427
Monmouth IL - MATH - MATH427
Monmouth IL - MATH - MATH427
cep 2008/09MT3802 - Numerical AnalysisTutorial Sheet 1 1. Show that the following satisfy the requirements of a norm specified on a Vector Space: (i)bf =a|f (x)|dxwhere f (x) C[a, b] ;(ii) x = max |xi |1inwhere x Rn .2. An inner product is defi
Monmouth IL - MATH - MATH427
cep 2008/09MT3802 - Numerical AnalysisTutorial Sheet 2 1. For a sub-ordinate matrix norm and an invertible matrix A, where Ax = b, show that (i) (ii) As AssN1 x A-1 A b2. Assume that (A + A)-1 is computed as an approximation to A-1 . Show that (A +
Monmouth IL - MATH - MATH427
Monmouth IL - MATH - MATH427
Monmouth IL - MATH - MATH427
cep 2008/09MT3802 - Numerical AnalysisTutorial Sheet 5 1. Let p1 (x) be the linear interpolant of f (x) at the points (x0 , f (x0 ) and (x1 , f (x1 ), where x1 - x0 = h. Show that for x [x0 , x1 ] f (x) - p1 (x) where f (x) M h2 8 M.Suppose ex on [-
Monmouth IL - CS - CS 399
ScriptEase: A Pattern Based Approach to ScriptingCurtis Onuczko Thursday, January 19, 2006Overview What is ScriptEase? Why use ScriptEase? When to use ScriptEase? How to use ScriptEase Tips and TricksWhat is ScriptEase?Why use ScriptEase?A tool to
Monmouth IL - CS - CS 399
Overview Game Creation ProcessCMPUT 299 Winter 2006 Thursday January 12 ! Making a computer game is a lengthy process, involving many creative people! High-profile productions often take 2-3 years ! Challenging games can involve &gt; 100 people!! This lec
Monmouth IL - CS - CS 399
convexity (series) new modes: adding multiplayerGame DesignCMPUT 299Finnegan Southey XBox Live GamerTag: Aleafeatures qbilities, training, introducing abilities critical gaming save dev qa coverage/replay approachable doors &amp; keys consuming items s
Monmouth IL - CS - CS 399
Lecture Review Sheet: Game Design Finnegan Southey CMPUT 299 Winter 2006 Terms and Definitions MDA n A model for game design that views the user experience as a three part process: mechanics, dynamics, and aesthetics Funativity n A model for types of &quot;fun
Monmouth IL - CS - CS 399
Overview! AnnouncementsWhat have we learned thus far?CMPUT 299 Fall 2005 Tuesday, January 31! ! ! !Design Document next Thursday Meet with producer beforehand BioWare internships (CS only) Lab this week/lab exam! NWN Module Discussion ! Computation
Monmouth IL - CS - CS 399
Management is Fundamentals of Project ManagementCMPUT 299 H. James Hoover Winter 2005 2005-09-22 Version 1.21 CMPUT 299 - Winter 2005 Project Management People Process Problem Solving2People Identify skills - have and missing Identify personalities
Monmouth IL - CS - CS 399
OpeningNarrative:Concepts of Narrative in Interactive New Media Art FormsLecture Goals for the next two classes1. Introduce concepts of traditional narrative, most of which apply to later technologies. 2. Discuss the application of these concepts to n
Monmouth IL - CS - CS 399
Meetings, Bloody Meetings How To Run MeetingsCMPUT 299 H. James Hoover Fall 2005 2005-09-23,27 Version 1.0CMPUT 299 - Fall 2005 How to Run Meetings Written by John Cleese and Antony Jay Starring John Cleese and Robert Hardy Video Arts, 1993 34 minMee
Monmouth IL - CS - CS 399
The Sims 2 More Post-Mortems, SharewareCMPUT 299 Winter 2005 February 16CMPUT 299 - Fall 2005 Game PostmortemsThe Sims 2! What went right! ! ! ! ! Prototyping Understanding the audience Kleenex testing Custom content and community SWAT TeamsCMPUT 29
Monmouth IL - CS - CS 399
Lecture Overview Artificial Intelligence Part ICMPUT 299 Winter 2006 February 28, 2006 ! Lab Exam! Course Evals! Design Issue Presentations ! Artificial Intelligence! Definition! Related concepts! Algorithm ! Time/Memory Cost! Finite State Machines
Monmouth IL - CS - CS 399
Lecture Overview Artificial Intelligence Part IICMPUT 299 Winter 2006 March 2, 2006 ! ! ! ! ! Lab Exam Pizza! Summary (Tuesday) Pathfinding Finite State MachinesCMPUT 299 - Fall 2005 Artificial IntelligenceLab Exam ScoresA+ A B CPizza!! Get together