Lecture 19. Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 1
|
|
- Mary Hoover
- 5 years ago
- Views:
Transcription
1 Lecture 19 Log into Linux. Copy files on csserver from /home/hwang/cs215/lecture19/*.* Reminder: Homework 8 due today. Homework 9 is posted (PDF only). They are sample written midterm exam problems. It is due on Monday at the beginning of class (no late work accepted) as part of the midterm exam review. Questions? Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 1
2 Outline Review node struct, list_length Linked list toolkit build as we go list_write not in the textbook list_head_insert, list_insert list_search const and non-const list_locate const and non-const list_head_remove, list_remove, list_clear list_copy Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 2
3 Review: node Structure Recall the node structure used in linked lists. struct node { typedef double value_type; // CONSTRUCTOR node(const value_type & init_data = value_type(), node *init_link = 0) { data = init_data; next = init_link; } // note, do not need ';' here // FIELDS value_type data; data next node *next; 3.14 }; Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 3
4 Review: Building a Linked List Examine file list-examples.cpp The first part is the examples from the last lecture that builds a linked list by hand using pointer variables to each node. The head pointer is r. r q t p Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 4
5 Linked-List Toolkit Examine file node1.h In addition to the node structure, it has the prototypes for some common functions that are used to access and manipulate linked lists. Call this the linked-list toolkit. Last time we looked at list_length, a function that computes the number of nodes in a linked list given its head pointer. size_t list_length (const node *head_ptr); Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 5
6 Linked List Toolkit Implementations for the toolkit functions are in file node1.cpp. A driver program is in file list-examples.cpp. A makefile is provided. Note that many functions are stubs and output a message saying so. This allows us to compile and run the entire program that uses them without implementing all the functions. Most the code that is missing is in the textbook using a node class; we will build the toolkit using the node struct as we go. Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 6
7 Review: list_length Pattern for accessing every node in a linked list is a for-loop. size_t list_length (const node *head_ptr) { size_t count = 0; const node *cursor; // lcv decl for (cursor = head_ptr; // init lcv cursor!= 0; // lcv end test cursor = cursor >link; // "incr" lcv count++; // loop body return count; } Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 7
8 In-class Exercise: list_write list_write outputs each item in a linked list to an output stream on a separate line. It receives the head pointer and an output stream. void list_write (const node *head_ptr, std::ostream & out); Write the implementation of list_write in the file node1.cpp. Compile and run the program. All of the calls to list_write should show the same 4 items, since the rest of the toolkit is not implemented. Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 8
9 list_head_insert A common operation on linked lists is to insert a new item at the head of the list. list_head_insert receives and passes back the head pointer (since it uses the head pointer's value and also changes it) and receives the item to be inserted. void list_head_insert (node * & head_ptr, const node::value_type & entry); Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 9
10 In-class Exercise: list_head_insert Implement this function in node1.cpp The design for this function is 1. Create a new node with entry as its data value and head_ptr as its link. 2. Make head_ptr point to the new node Here is a picture of list_head_insert(r, 1.2): At the beginning of the function headptr 12.1 At the end of the function headptr 12.1 entry 1.2 insertptr 1.2 Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 10
11 list_insert list_insert is used to insert items anywhere else besides the head of the list. In order to do this, it receives a pointer to the node that will be in front of the new node containing entry. Call this the previous pointer. void list_insert (node * previous_ptr, const value_type & entry); Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 11
12 In-class Exercise: list_insert Implement this function in node1.cpp The design for this function is 1. Create a new node with entry as its data value and previous_ptr's node's link as its link. 2. Make previous_ptr's node's link point to the new node Note this works even when previous_ptr is pointing the last node in the list. A picture of list_insert(q, -7.8) is shown on the next slide. Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 12
13 list_insert At the beginning of the function previousptr entry 7.8 At the end of the function previousptr insertptr 7.8 Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 13
14 list_search list_search receives a head pointer and a target value. It returns a pointer to the first node that contains the target value or 0 if the target is not found. As with searching arrays and vectors, the design of this function is to iterate through the list and returning a pointer when the target is found. It has both const and non-const versions. Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 14
15 list_locate list_locate receives a head pointer and a position. It returns a pointer to the node at that position, or 0 if there is no such position. Per the specifications in the textbook, item positions start at 1 (not 0). This function uses an assert to ensure that position > 0. The design of this function is to iterate through the list until the position is found or the end of the list is reached. It has both const and non-const versions Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 15
16 list_head_remove As with inserting, removing an item at the head of a list is different than removing an item anywhere else in the list. list_head_remove receives and passes back the head pointer of a list. The result of the function is that the head pointer now points to what was the second item in the list, and the removed node is deallocated. void list_head_remove (node * & head_ptr); Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 16
17 In-class Exercise: list_head_remove Implement this function in node1.cpp The design of this function is 1. Make the head pointer point to the second node in the list 2. Deallocate the first node Here is a picture of list_head_remove(r): At the beginning of the function head_ptr At the end of the function remove_ptr head_ptr Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 17
18 list_remove list_remove is used to remove items anywhere else besides the head of the list. As with list_insert, it receives a previous pointer to the node that is in front of the node being removed. The result of this function is previous_ptr's link now points to the node after the one it originally pointed to, and the removed node is deallocated. Note this assumes that previous_ptr is not pointing to the tail node. void list_remove (node * previous_ptr); Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 18
19 In-class Exercise: list_remove Implement this function in node1.cpp The design of this function is 1. Make the previous_ptr's link point to the node after the one it currently points to 2. Deallocate the removed node Here is a picture of list_remove(t): At the beginning of the function previousptr At the end of the function previousptr removeptr Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 19
20 list_clear list_clear receives a head pointer. It deallocates all of the nodes in the list and sets the head to 0. This is useful for the destructor and assignment operator of classes using a linked list as an implementation. This function uses list_head_remove repeatedly until the head pointer is 0. Uncomment the implementation of list_clear in node1.cpp. Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 20
21 list_copy The copy constructor and assignment operator of classes using a linked list as an implementation need to be able to make a copy of a linked list. list_copy receives the head pointer for a source list and passes back the head and tail pointers of the copy. Since this is a true copy, the two lists do not share any nodes. void list_copy (const node *source_ptr, node * & head_ptr, // of copy node * & tail_ptr); // of copy Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 21
22 In-class Exercise: list_copy Implement this function in node1.cpp The design for this function is 1. Initialize head_ptr and tail_ptr to Handle the case of an empty source list. 3. Create the head node of the copy and make head_ptr and tail_ptr point to it. 4. For each of the remaining source nodes, make a copy and add it at the tail of the new list. Wednesday, February 23 CS 215 Fundamentals of Programming II - Lecture 19 22
Lecture 9 Linked Lists
CSC212 Data Structure - Section FG Lecture 9 Linked Lists Instructor: Feng HU Department of Computer Science City College of New York Motivation In a sequence using an array, inserting a new item needs
More informationvoid set_data(const value_type& new_data) { data_field = new_data; } void set_link(node* new_link) { link_field = new_link; }
node1.h Page 1 of 1 class node // TYPEDEF typedef double value_type; // CONSTRUCTOR node( const value_type& init_data = value_type( ), node* init_link = NULL ) data_field = init_data; link_field = init_link;
More informationCSC212 Data Structure - Section FG
CSC212 Data Structure - Section FG Lecture 10 The Bag and Sequence Classes with Linked Lists Instructor: Feng HU Department of Computer Science City College of New York @ Feng HU, 2016 1 Reviews: Node
More informationLinked Lists in Action
Linked Lists in Action Chapter 5 introduces the oftenused data structure of linked lists. This presentation shows how to implement the most common operations on linked lists. CHAPTER 5 Data Structures
More informationLecture 12. Monday, February 7 CS 215 Fundamentals of Programming II - Lecture 12 1
Lecture 12 Log into Linux. Copy files on csserver in /home/hwang/cs215/lecture12/*.* Reminder: Practical Exam 1 is Wednesday 3pm-5pm in KC-267. Questions about Project 2 or Homework 6? Submission system
More informationLAB 5, THE HIDDEN DELIGHTS OF LINKED LISTS
LAB 5, THE HIDDEN DELIGHTS OF LINKED LISTS Questions are based on the Main and Savitch review questions for chapter 5 in the Exam Preparation section of the webct course page. In case you haven t observed
More informationLecture 34. Wednesday, April 6 CS 215 Fundamentals of Programming II - Lecture 34 1
Lecture 34 Log into Linux. Copy files on csserver from /home/hwang/cs215/lecture33/*.* In order to compile these files, also need bintree.h from last class. Project 7 posted. Due next week Friday, but
More informationLecture 7. Log into Linux New documents posted to course webpage
Lecture 7 Log into Linux New documents posted to course webpage Coding style guideline; part of project grade is following this Homework 4, due on Monday; this is a written assignment Project 1, due next
More informationCS 215 Fundamentals of Programming II Spring 2018 Project 5
CS 215 Fundamentals of Programming II Spring 2018 Project 5 30 points Out: March 23, 2018 Due: April 9, 2018 (Monday) As explained in Project 3, a line editor is a text editor that operates on lines of
More informationLinked Lists. It s a conspiracy!
Linked Lists It s a conspiracy! 1 Linked list: a data structure used to represent an ordered list Consists of a sequence of nodes A node consists of a data item and a reference to the next node -- the
More informationInstructions PLEASE READ (notice bold and underlined phrases)
Lab Exercises wk12 Practice with Linked Lists Required Reading Chapter 13 - Pointers and Linked Lists Lecture Slides on Linked Lists, Presented in class wk11 Instructions PLEASE READ (notice bold and underlined
More informationSpring 2003 Instructor: Dr. Shahadat Hossain. Administrative Matters Course Information Introduction to Programming Techniques
1 CPSC2620 Advanced Programming Spring 2003 Instructor: Dr. Shahadat Hossain 2 Today s Agenda Administrative Matters Course Information Introduction to Programming Techniques 3 Course Assessment Lectures:
More informationl Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)
Final Exam Exercises Chapters 1-7 + 11 Write C++ code to: l Determine if a number is odd or even CS 2308 Fall 2016 Jill Seaman l Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More informationCpSc212 Goddard Notes Chapter 10. Linked Lists
CpSc212 Goddard Notes Chapter 10 Linked Lists 10.1 Links and Pointers The linked list is not an ADT in its own right; rather it is a way of implementing many data structures. It is designed to replace
More informationAnd Even More and More C++ Fundamentals of Computer Science
And Even More and More C++ Fundamentals of Computer Science Outline C++ Classes Special Members Friendship Classes are an expanded version of data structures (structs) Like structs, the hold data members
More information! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)
Final Exam Exercises Chapters 1-7 + 11 Write C++ code to:! Determine if a number is odd or even CS 2308 Fall 2018 Jill Seaman! Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More informationMidterm Exam #2 Review. CS 2308 :: Spring 2016 Molly O'Neil
Midterm Exam #2 Review CS 2308 :: Spring 2016 Molly O'Neil Midterm Exam #2 Wednesday, April 13 In class, pencil & paper exam Closed book, closed notes, no cell phones or calculators, clean desk 20% of
More informationCpt S 122 Data Structures. Course Review Midterm Exam # 1
Cpt S 122 Data Structures Course Review Midterm Exam # 1 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Midterm Exam 1 When: Friday (09/28) 12:10-1pm Where:
More informationCS302 - Data Structures using C++
CS302 - Data Structures using C++ Topic: Linked Lists Implementation of the Bag ADT Kostas Alexis Consider we need to store data, we need to store data of certain type and we need to have a specific way
More information! Determine if a number is odd or even. ! Determine if a number/character is in a range. ! Assign a category based on ranges (wind speed)
Final Exam Exercises Chapters 1-7 + 11 Write C++ code to:! Determine if a number is odd or even CS 2308 Spring 2013 Jill Seaman! Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More informationCS 215 Fundamentals of Programming II Spring 2010 Project 6. Dnode<T> structure. Specifications for Document Class. 30 points
CS 215 Fundamentals of Programming II Spring 2010 Project 6 30 points Out: March 26, 2010 Due: April 14, 2010 A line editor is a text editor that operates on lines of a textfile. A line editor manipulates
More informationCourse Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++
Introduction to Programming in C++ Course Text Programming in C++, Zyante, Fall 2013 edition. Course book provided along with the course. Course Description This course introduces programming in C++ and
More informationCSE 333 Midterm Exam Nov. 3, 2017 Sample Solution
Question 1. (8 points) Making things. Consider this (buggy) Makefile (the options -Wall, -g, and -std=c11 were omitted to save space and do not affect the answers): all: prog foo.c: foo.c foo.h bar.h gcc
More informationReview for Test 1 (Chapter 1-5)
Review for Test 1 (Chapter 1-5) 1. Software development 1. Pre-conditions and Post-conditions 2. Running time analysis Big O Timing loops and nested loops 1) Write the simplest big-o expression to describe
More informationUnit 10: Data Structures CS 101, Fall 2018
Unit 10: Data Structures CS 101, Fall 2018 Learning Objectives After completing this unit, you should be able to: Define and give everyday examples of arrays, stacks, queues, and trees. Explain what a
More informationPhysics 2660: Fundamentals of Scientific Computing. Lecture 7 Instructor: Prof. Chris Neu
Physics 2660: Fundamentals of Scientific Computing Lecture 7 Instructor: Prof. Chris Neu (chris.neu@virginia.edu) Reminder HW06 due Thursday 15 March electronically by noon HW grades are starting to appear!
More informationCpt S 122 Data Structures. Course Review Midterm Exam # 2
Cpt S 122 Data Structures Course Review Midterm Exam # 2 Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Midterm Exam 2 When: Monday (11/05) 12:10 pm -1pm
More informationBeijing Jiaotong University CS-23: C++ Programming Summer, 2019 Course Syllabus
Beijing Jiaotong University CS-23: C++ Programming Summer, 2019 Course Syllabus Course Personnel: Instructor Name: Jovan Ilić Office: TBD Phone: TBD e-mail: TBD Teaching Assistants Name: TBD Office: TBD
More informationMore on Arrays CS 16: Solving Problems with Computers I Lecture #13
More on Arrays CS 16: Solving Problems with Computers I Lecture #13 Ziad Matni Dept. of Computer Science, UCSB Announcements Homework #12 due today No homework assigned today!! Lab #7 is due on Monday,
More informationOut: April 19, 2017 Due: April 26, 2017 (Wednesday, Reading/Study Day, no late work accepted after Friday)
CS 215 Fundamentals of Programming II Spring 2017 Programming Project 7 30 points Out: April 19, 2017 Due: April 26, 2017 (Wednesday, Reading/Study Day, no late work accepted after Friday) This project
More information(More) Fun with Pointers and Linked Lists! CS 16: Solving Problems with Computers I Lecture #17
(More) Fun with Pointers and Linked Lists! CS 16: Solving Problems with Computers I Lecture #17 Ziad Matni Dept. of Computer Science, UCSB Administrative Homework situation: Labs: NO MORE HOMEWORK! J Lab10
More informationMidterm Review. CS 211 Fall 2018
Midterm Review CS 211 Fall 2018 BSB 250 Official Time: 10:00 am to 10:50 am If we can start a few minutes early, we will So try to arrive closer to 9:50am We will need to finish right at 10:50 since there
More information! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)
Final Exam Exercises CS 2308 Spring 2014 Jill Seaman Chapters 1-7 + 11 Write C++ code to: Determine if a number is odd or even Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More informationLecture 14. No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions?
Lecture 14 No in-class files today. Homework 7 (due on Wednesday) and Project 3 (due in 10 days) posted. Questions? Friday, February 11 CS 215 Fundamentals of Programming II - Lecture 14 1 Outline Static
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationCS 215 Fundamentals of Programming II Fall 2017 Project 7. Morse Code. 30 points. Out: November 20, 2017 Due: December 4, 2017 (Monday) a n m
CS 215 Fundamentals of Programming II Fall 2017 Project 7 30 points Out: November 20, 2017 Due: December 4, 2017 (Monday) This project is to build a Morse code tree and use it to encode and decode messages.
More informationCome to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.
It is most beneficial to you to write this mock midterm UNDER EXAM CONDITIONS. This means: Complete the mock final in 170 minutes. Work on your own. Keep your notes and textbook closed. Attempt every question.
More informationProgramming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11
Programming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11 Ziad Matni Dept. of Computer Science, UCSB Thursday, 5/17 in this classroom Starts at 2:00 PM **SHARP** Please
More informationClass Information ANNOUCEMENTS
Class Information ANNOUCEMENTS Third homework due TODAY at 11:59pm. Extension? First project has been posted, due Monday October 23, 11:59pm. Midterm exam: Friday, October 27, in class. Don t forget to
More information2. COURSE DESIGNATION: 3. COURSE DESCRIPTIONS:
College of San Mateo Official Course Outline 1. COURSE ID: CIS 278 TITLE: (CS1) Programming Methods: C++ C-ID: COMP 122 Units: 4.0 units Hours/Semester: 48.0-54.0 Lecture hours; 48.0-54.0 Lab hours; and
More informationLecture 6 Dynamic Classes and the Law of the Big Three. Instructor: George Wolberg Department of Computer Science City College of New York
CSC212 Data Structure Lecture 6 Dynamic Classes and the Law of the Big Three Instructor: George Wolberg Department of Computer Science City College of New York @ George Wolberg, 2016 1 Why Dynamic Classes
More informationLinked Lists Structures
Linked Lists Structures 1. Motivation... 2 2. Declaration of a node... 3 2.1. Operations on pointers:... 4 2.2. Disposition of a node... 5 2.3. Singly Linked Lists... 5 3. One-way linked lists... 6 3.1.
More informationHomework 3 Grade Database Management Due Date
Homework 3 Grade Database Management Due Date Project Statement This assignment is meant to grant you further C experience inside a full Linux environment. You will be designing software that creates a
More informationdouble d0, d1, d2, d3; double * dp = new double[4]; double da[4];
All multiple choice questions are equally weighted. You can generally assume that code shown in the questions is intended to be syntactically correct, unless something in the question or one of the answers
More informationThe C++ Object Lifecycle. EECS 211 Winter 2019
The C++ Object Lifecycle EECS 211 Winter 2019 2 Initial code setup $ cd eecs211 $ curl $URL211/lec/09lifecycle.tgz tar zx $ cd 09lifecycle 3 Road map Owned string type concept Faking it An owned string
More informationIntermediate Programming, Spring 2017*
600.120 Intermediate Programming, Spring 2017* Misha Kazhdan *Much of the code in these examples is not commented because it would otherwise not fit on the slides. This is bad coding practice in general
More informationCS 61B, Spring 1996 Midterm #1 Professor M. Clancy
CS 61B, Spring 1996 Midterm #1 Professor M. Clancy Problem 0 (1 point, 1 minute) Put your login name on each page. Also make sure you have provided the information requested on the first page. Problem
More informationECE 264 Exam 2. 6:30-7:30PM, March 9, You must sign here. Otherwise you will receive a 1-point penalty.
ECE 264 Exam 2 6:30-7:30PM, March 9, 2011 I certify that I will not receive nor provide aid to any other student for this exam. Signature: You must sign here. Otherwise you will receive a 1-point penalty.
More informationCentral Washington University Department of Computer Science Course Syllabus
Central Washington University Department of Computer Science Course Syllabus CS 110: Programming Fundamentals I December 27, 2015 1 Course Information Course Information Lecture: Mo,Tu,We: 10:00AM - 10:50AM,
More informationG205 Fundamentals of Computer Engineering. CLASS 3, Wed. Sept Stefano Basagni Fall 2004 M-W, 1:30pm-3:10pm
G205 Fundamentals of Computer Engineering CLASS 3, Wed. Sept. 15 2004 Stefano Basagni Fall 2004 M-W, 1:30pm-3:10pm Function Calls A function is called via its name Actual parameters are passed for the
More informationCS302 Data Structures using C++
CS302 Data Structures using C++ Study Guide for the Midterm Exam Fall 2018 This document serves to help you prepare towards the midterm exam for the Fall 2018 semester. 1. What topics are to be covered
More informationCMSC 341 Lecture 7 Lists
CMSC 341 Lecture 7 Lists Today s Topics Linked Lists vs Arrays Nodes Using Linked Lists Supporting Actors (member variables) Overview Creation Traversal Deletion UMBC CMSC 341 Lists 2 Linked Lists vs Arrays
More informationCSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too)
CSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too) HW6 NOTE: Do not use the STL map or STL pair for HW6. (It s okay to use them for the contest.)
More informationCompulsory course in Computer Science
Compulsory course in Computer Science University of Macau Faculty of Science and Technology Department of Computer and Information Science SFTW241 Programming Languages Architecture I Syllabus 2 nd Semester
More informationCSC 210, Exam Two Section February 1999
Problem Possible Score 1 12 2 16 3 18 4 14 5 20 6 20 Total 100 CSC 210, Exam Two Section 004 7 February 1999 Name Unity/Eos ID (a) The exam contains 5 pages and 6 problems. Make sure your exam is complete.
More informationArrays 2 CS 16: Solving Problems with Computers I Lecture #12
Arrays 2 CS 16: Solving Problems with Computers I Lecture #12 Ziad Matni Dept. of Computer Science, UCSB Material: Post- Midterm #1 Lecture 7 thru 12 Homework, Labs, Lectures, Textbook Tuesday, 11/14 in
More informationCMSC162 Intro to Algorithmic Design II Blaheta. Lab March 2019
CMSC162 Intro to Algorithmic Design II Blaheta Lab 10 28 March 2019 This week we ll take a brief break from the Set library and revisit a class we saw way back in Lab 4: Card, representing playing cards.
More informationQUIZ How do we implement run-time constants and. compile-time constants inside classes?
QUIZ How do we implement run-time constants and compile-time constants inside classes? Compile-time constants in classes The static keyword inside a class means there s only one instance, regardless of
More informationCSE 333. Lecture 11 - constructor insanity. Hal Perkins Paul G. Allen School of Computer Science & Engineering University of Washington
CSE 333 Lecture 11 - constructor insanity Hal Perkins Paul G. Allen School of Computer Science & Engineering University of Washington Administrivia Exercises: - New exercise out today, due Monday morning
More information! Mon, May 5, 2:00PM to 4:30PM. ! Closed book, closed notes, clean desk. ! Comprehensive (covers entire course) ! 30% of your final grade
Final Exam Review Final Exam Mon, May 5, 2:00PM to 4:30PM CS 2308 Spring 2014 Jill Seaman Closed book, closed notes, clean desk Comprehensive (covers entire course) 30% of your final grade I recommend
More informationUniversity of Illinois at Urbana-Champaign Department of Computer Science. First Examination
University of Illinois at Urbana-Champaign Department of Computer Science First Examination CS 225 Data Structures and Software Principles Spring 2007 7p-9p, Thursday, March 1 Name: NetID: Lab Section
More informationSlide Set 14. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary
Slide Set 14 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary November 2016 ENCM 339 Fall 2016 Slide Set 14 slide 2/35
More informationLecture 32. No computer use today. Reminders: Homework 11 is due today. Project 6 is due next Friday. Questions?
Lecture 32 No computer use today. Reminders: Homework 11 is due today. Project 6 is due next Friday. Questions? Friday, April 1 CS 215 Fundamentals of Programming II - Lecture 32 1 Outline Introduction
More informationCS 61B, Spring 1996 Midterm #1 Professor M. Clancy
CS 61B, Spring 1996 Midterm #1 Professor M. Clancy Problem 0 (1 point, 1 minute) Put your login name on each page. Also make sure you have provided the information requested on the first page. Problem
More informationLecture 18 Tao Wang 1
Lecture 18 Tao Wang 1 Abstract Data Types in C++ (Classes) A procedural program consists of one or more algorithms that have been written in computerreadable language Input and display of program output
More informationCSC212. Data Structure. Lecture 9 Templates, Iterators and STL. Instructor: George Wolberg Department of Computer Science City College of New York
CSC212 Data Structure Lecture 9 Templates, Iterators and STL Instructor: George Wolberg Department of Computer Science City College of New York Topics Template Functions and Template Classes for code that
More informationSoftware Engineering Concepts: Invariants Silently Written & Called Functions Simple Class Example
Software Engineering Concepts: Invariants Silently Written & Called Functions Simple Class Example CS 311 Data Structures and Algorithms Lecture Slides Friday, September 11, 2009 continued Glenn G. Chappell
More informationEric Roberts Handout #39 CS 106B February 20, 2015 Sets
Eric Roberts Handout #39 S 106 February 20, 2015 Sets Sets Eric Roberts S 106 February 20, 2015 Outline 1. Midcourse correction 2. Sets in mathematics 3. Venn diagrams 4. High-level set operations 5. Implementing
More informationPIC10B/1 Winter 2014 Exam I Study Guide
PIC10B/1 Winter 2014 Exam I Study Guide Suggested Study Order: 1. Lecture Notes (Lectures 1-8 inclusive) 2. Examples/Homework 3. Textbook The midterm will test 1. Your ability to read a program and understand
More informationCompiling with Multiple Files The Importance of Debugging CS 16: Solving Problems with Computers I Lecture #7
Compiling with Multiple Files The Importance of Debugging CS 16: Solving Problems with Computers I Lecture #7 Ziad Matni Dept. of Computer Science, UCSB Programming in Multiple Files The Magic of Makefiles!
More informationCSE 303 Concepts and Tools for Software Development. Magdalena Balazinska Winter 2010 Lecture 27 Final Exam Revision
CSE 303 Concepts and Tools for Software Development Magdalena Balazinska Winter 2010 Lecture 27 Final Exam Revision Today Final review session! The final is not yet written, but you know roughly what it
More informationCS Spring 2018 Homework Assignment 3 Due: 23:59, May 7, 2018
CS 201 - Spring 2018 Homework Assignment 3 Due: 23:59, May 7, 2018 In this homework, you will implement an academic conference system (ACS). A conference has a a list of tracks. A track represents a specific
More informationLinked Lists. Gaddis Ch. 17. CS 2308 :: Spring 2016 Molly O'Neil
Linked Lists Gaddis Ch. 17 CS 2308 :: Spring 2016 Molly O'Neil List ADT A list is an abstract data type representing an ordered sequence of values For example, both MP3 Player assignments have used lists:
More informationCSCI-1200 Data Structures Spring 2014 Lecture 5 Pointers, Arrays, Pointer Arithmetic
CSCI-1200 Data Structures Spring 2014 Lecture 5 Pointers, Arrays, Pointer Arithmetic Announcements: Test 1 Information Test 1 will be held Monday, February 10th, 2014 from 6-7:50pm, Lab sections 1-5 and
More informationCSCI 102L - Data Structures Midterm Exam #1 Fall 2011
Print Your Name: Page 1 of 8 Signature: Aludra Loginname: CSCI 102L - Data Structures Midterm Exam #1 Fall 2011 (10:00am - 11:12am, Wednesday, October 5) Instructor: Bill Cheng Problems Problem #1 (24
More informationMidterm Examination # 2 Wednesday, March 19, Duration of examination: 75 minutes STUDENT NAME: STUDENT ID NUMBER:
Page 1 of 7 School of Computer Science 60-141-01 Introduction to Algorithms and Programming Winter 2014 Midterm Examination # 2 Wednesday, March 19, 2014 ANSWERS Duration of examination: 75 minutes STUDENT
More informationlibqsearch A library designed for fast multiple pattern matching
libqsearch A library designed for fast multiple pattern matching Philippe Biondi FOSDEM 2003 February 8-9th, 2003 Outline 1 What is libqsearch? Presentation History Architecture
More informationImplementing Linked Lists
Implementing Linked Lists Lecture 16 Sections 17.1-17.3 Robb T. Koether Hampden-Sydney College Wed, Feb 27, 2013 Robb T. Koether (Hampden-Sydney College) Implementing Linked Lists Wed, Feb 27, 2013 1 /
More informationLecture 8. Xiaoguang Wang. February 13th, 2014 STAT 598W. (STAT 598W) Lecture 8 1 / 47
Lecture 8 Xiaoguang Wang STAT 598W February 13th, 2014 (STAT 598W) Lecture 8 1 / 47 Outline 1 Introduction: C++ 2 Containers 3 Classes (STAT 598W) Lecture 8 2 / 47 Outline 1 Introduction: C++ 2 Containers
More informationCS Fall 2018 Homework Assignment 3 Due: 23:59, Dec 26, 2018
CS 201 - Fall 2018 Homework Assignment 3 Due: 23:59, Dec 26, 2018 In this homework, you will implement a simple phonebook. A phonebook has a list of people. Each person has a name and a list of phone numbers.
More informationslide 1 gaius Game Trees
Game Trees slide 1 in this section of the course we will look at the following topics (and not in this order and not sequentially): Cprogramming game tree searching minimax, alphabeta Othello Chess evaluation
More informationCS201 Some Important Definitions
CS201 Some Important Definitions For Viva Preparation 1. What is a program? A program is a precise sequence of steps to solve a particular problem. 2. What is a class? We write a C++ program using data
More informationWeek 8: Operator overloading
Due to various disruptions, we did not get through all the material in the slides below. CS319: Scientific Computing (with C++) Week 8: Operator overloading 1 The copy constructor 2 Operator Overloading
More informationCS 241 Data Organization. August 21, 2018
CS 241 Data Organization August 21, 2018 Contact Info Instructor: Dr. Marie Vasek Contact: Private message me on the course Piazza page. Office: Room 2120 of Farris Web site: www.cs.unm.edu/~vasek/cs241/
More informationCMPSCI 377 Midterm (Sample) Name:
CMPSCI 377 Midterm (Sample) You will have 90 minutes to work on this exam, which is closed book. There are 4 problems on 9 pages. Please write your name on EVERY page. You are to abide by the University
More informationCS427 Inheritance and Virtual Functions. Linked lists. 2/27. 01Replacement.cpp link! i n t GetY ( void ) { return ( y ) ; } ;
Inheritance and Virtual Functions. Linked lists. CS427 Lecture 12.2, 11am, 26th March 2012 In today s class 1 Recall... Inheritance 2 3 4 Limitations of arrays 5 Linked lists 6 7 8 Further linked list
More informationProgramming Assignment #4 Binary Trees in C++
Programming Assignment #4 Binary Trees in C++ Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2 nd edition, by Kernighan and Ritchie,
More informationCS 470 Operating Systems Spring 2013 Shell Project
CS 470 Operating Systems Spring 2013 Shell Project 40 points Out: January 11, 2013 Due: January 25, 2012 (Friday) The purpose of this project is provide experience with process manipulation and signal
More informationMidterm Examination # 2 Wednesday, March 18, Duration of examination: 75 minutes STUDENT NAME: STUDENT ID NUMBER:
Page 1 of 8 School of Computer Science 60-141-01 Introduction to Algorithms and Programming Winter 2015 Midterm Examination # 2 Wednesday, March 18, 2015 ANSWERS Duration of examination: 75 minutes STUDENT
More informationCS61C Machine Structures. Lecture 3 Introduction to the C Programming Language. 1/23/2006 John Wawrzynek. www-inst.eecs.berkeley.
CS61C Machine Structures Lecture 3 Introduction to the C Programming Language 1/23/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L03 Introduction to C (1) Administrivia
More informationAnnouncements. mp3.1 extra credit due tomorrow lab quacks due Saturday night (6/29) mp3 due Monday (7/1)
lecture12: Largely based on slides by Cinda Heeren CS 225 UIUC 27th June, 2013 Announcements mp3.1 extra credit due tomorrow lab quacks due Saturday night (6/29) mp3 due Monday (7/1) Source: http://i.dailymail.co.uk/i/pix/2010/08/04/article-1300471-0ab0a1d2000005dc-451
More informationCS 215 Fundamentals of Programming II Spring 2011 Project 2
CS 215 Fundamentals of Programming II Spring 2011 Project 2 20 points Out: February 2, 2011 Due: February 9, 2011 Reminder: Programming Projects (as opposed to Homework exercises) are to be your own work.
More informationOutline. Computer programming. Usage of time and date functions. Date and Time: time.h. Date and Time: time.h. Time functions:
Outline Computer programming "An expert is a man who has made all the mistakes which can be made, in a narrow field." Niels Bohr Working with time I/O redirection Variable length argument lists Command
More informationSYSC 2006 CD. Come to the PASS workshop with your mock exam complete. During the workshop you can work with other students to review your work.
It is most beneficial to you to write this mock midterm UNDER EXAM CONDITIONS. This means: Complete the mock final in 180 minutes. Work on your own. Keep your notes and textbook closed. Attempt every question.
More informationPractical C++ Programming
SECOND EDITION Practical C++ Programming Steve Oualline O'REILLY' Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo Preface xv Part I. The Basics 1. What Is C++? 3 A Brief History of C++ 3 C++
More informationSan José State University Department of Computer Science CS-144, Advanced C++ Programming, Section 1, Fall 2017
San José State University Department of Computer Science CS-144, Advanced C++ Programming, Section 1, Fall 2017 Course and Contact Information Instructor: Office Location: Fabio Di Troia DH282 Telephone:
More informationCOMP26120: Linked List in C (2018/19) Lucas Cordeiro
COMP26120: Linked List in C (2018/19) Lucas Cordeiro lucas.cordeiro@manchester.ac.uk Linked List Lucas Cordeiro (Formal Methods Group) lucas.cordeiro@manchester.ac.uk Office: 2.28 Office hours: 10-11 Tuesday,
More informationCS 202 Fundamental Structures of Computer Science II
CS 202 Fundamental Structures of Computer Science II Assignment 5 Date Assigned: December 11, 2015 Due Date: December 25, 2015-23:55 (sharp) Question-1 (20 points) For the graph given below, give the sequence
More informationINHERITANCE: CONSTRUCTORS,
INHERITANCE: CONSTRUCTORS, DESTRUCTORS, HEADER FILES Pages 720 to 731 Anna Rakitianskaia, University of Pretoria CONSTRUCTORS Constructors are used to create objects Object creation = initialising member
More information