Jeff West - Quiz Section 9

Slides:



Advertisements
Similar presentations
1 Linked lists Sections 3.2, 3.3, 3.5 Chapter 3 Lists, Stacks, and Queues Abstract Data Types, Vectors.
Advertisements

Lists: An internal look
Chapter 17 vector and Free Store John Keyser’s Modifications of Slides By Bjarne Stroustrup
Review of Stacks and Queues Dr. Yingwu Zhu. Our Focus Only link-list based implementation of Stack class Won’t talk about different implementations of.
Lecture 3 Feb 4 summary of last week’s topics and review questions (handout) Today’s goals: Chapter 1 overview (sections 1.4 to 1.6) c++ classes constructors,
Stacks  Standard operations: IsEmpty … return true iff stack is empty Top … return top element of stack Push … add an element to the top of the stack.
Welcome to IT133 Software Applications Unit 8 aka Prof Brooke.
1 Today’s Objectives  Announcements Turn in Homework #1 Homework #2 is posted and it is due on 21-Jun  Review Quiz #1  Pointers and C-style strings.
Go to your school’s web locker site school name.schoolweblockers.com) Your user name is the first letter of your first name, the first four.
Pointers Pointer a data type stores a memory address points to whatever the memory location contains A pointer is a variable that can store a memory address.
1 Linked Stack Chapter 4. 2 Linked Stack We can implement a stack as a linked list. Same operations. No fixed maximum size. Stack can grow indefinitely.
Lab 7 Queue ADT. OVERVIEW The queue is one example of a constrained linear data structure. The elements in a queue are ordered from least recently added.
Go to your school’s web locker site Your user name is the first letter of your first name, the first four letters of.
(c) University of Washington15-1 CSC 143 Java List Implementation via Arrays Reading: 13.
CPSC 252 The Big Three Page 1 The “Big Three” Every class that has data members pointing to dynamically allocated memory must implement these three methods:
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department.
Linked Lists part 1 CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and Computer Science University.
Lab 6 Stack ADT. OVERVIEW The stack is one example of a constrained linear data structure. In a stack, the elements are ordered from most recently added.
Arrays-. An array is a way to hold more than one value at a time. It's like a list of items.
1 Linked Lists Chapter 3. 2 Objectives You will be able to: Describe an abstract data type for lists. Understand and use an implementation of a List ADT.
1 Linked Multiple Queues. 2 A real world example. Not in the book. Sometimes we have a fixed number of items that move around among a fixed set of queues.
CSCI  Sequence Containers – store sequences of values ◦ vector ◦ deque ◦ list  Associative Containers – use “keys” to access data rather than.
1 Welcome Alireza Humber College Lecture 1 Game 540 Alireza
On dynamic memory and classes ● We previously had only discussed dynamic memory in regards to structs and dynamic arrays. ● However, they can be used (to.
Welcome to Mario Kart!... Er… EECS 183 Discussion!
Yan Shi CS/SE 2630 Lecture Notes
C++ Memory Management – Homework Exercises
Values vs. References Lecture 13.
Learning Objectives Pointers as dada members
Vectors Holds a set of elements, like an array
CMSC202 Computer Science II for Majors Lecture 08 – Overloaded Constructors Dr. Katherine Gibson Based on slides by Chris Marron at UMBC.
Stacks.
Lesson 14 Copy and Assignment
Lists The List ADT.
LinkedList Class.
The Bag and Sequence Classes with Linked Lists
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Prof. Neary Adapted from slides by Dr. Katherine Gibson
Dynamically Allocated Memory
CMPE212 – Stuff… Exercises 4, 5 and 6 are all fair game now.
Array Lists Chapter 6 Section 6.1 to 6.3
Chapter 16-2 Linked Structures
CSC 113 Tutorial QUIZ I.
Lecture 2: Implementing ArrayIntList reading:
Foundational Data Structures
Overview of Memory Layout in C++
Introduction to Metabolism & Homeostasis
Doubly Linked List Implementation
Indirection.
Class Examples.
Chapter 16 Linked Structures
Jeff West - Quiz Section 15
Jeff West - Quiz Section 4
Jeff West - Quiz Section 8
Jeff West - Quiz Section 6
What It Is and How It Works
Fall 2018 CISC124 2/24/2019 CISC124 Quiz 1 marking is complete. Quiz average was about 40/60 or 67%. TAs are still grading assn 1. Assn 2 due this Friday,
Class and Objects In a class, all the functions that operate on the data structure are grouped together in one place along with the data Like a struct.
CSC212 Data Structure - Section RS
Jeff West - Quiz Section 16
Lists CMSC 202, Version 4/02.
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Instructor: Dr. Michael Geiger Spring 2019 Lecture 23: Exam 2 Preview
Doubly Linked List Implementation
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Destructors, Copy Constructors & Copy Assignment Operators
Destructors, Copy Constructors & Copy Assignment Operators
This.
CSE 333 – Section 5 C++ (1m).
Data Structures & Programming
Presentation transcript:

Jeff West - Quiz Section 9 CSE 143 Section AD Quiz Section 9 7/17/2001 Jeff West - Quiz Section 9

Jeff West - Quiz Section 9 Announcements I’d like to welcome as much feedback as possible about how well quiz sections are preparing you so please feel free to talk to me about them… I have linked a feedback form from the Section AD web page if you want to remain anonymous… Grades are on the course website – check to make sure yours are right ;) There is a midterm in Thursday… if there is anything at all that is unclear to you please email me or visit my office hours! 7/17/2001 Jeff West - Quiz Section 9

Jeff West - Quiz Section 9 Character As a game designer, we have created the following class for a character: class Character { public: Character(string newName, int newLevel, int newExp); void drawCharacter(); private: string name; // character’s name int level; // current level int experience; // current experience }; 7/17/2001 Jeff West - Quiz Section 9

Jeff West - Quiz Section 9 CharacterList We want to store all of the users that are in the game in a CharacterList so that we could run the following code: CharacterList players1, players2; players.addPlayer(“Jeff”, 50, 50000); players2 = players1; CharacterList players3 = players1; List as many useful functions as you can to make this CharacterList as efficient as possible. HINT: SEE SLIDE N-35 7/17/2001 Jeff West - Quiz Section 9

Jeff West - Quiz Section 9 CharacterList class CharacterList { public: CharacterList(); // default constructor CharacterList(const CharacterList&); // copy constructor CharacterList& CharacterList::operator=(CharacterList& other); // controls assignment of CharacterLists ~CharacterList(); // destructor void copy(CharacterList& other); // copy’s other’s values to this instance void cleanup(); // cleans up this instance of the class bool isEmpty(); // is list empty? int length(); // how big is list? void addPlayer(string newName, int newLevel, int newExp); // insert a new character Character listDelete(int position); // deletes character at this location Character listRetrieve(int position); // returns character at this location private: Character* characters; // characters[0…capacity-1] is space allocated for this vector int size; // characters are store in characters[0…size-1] int capacity; // current maximum array size void ensureCapacity(int n); // ensure the list can hold at least n elements void growArray(int n); // set size of the list to n elements }; 7/17/2001 Jeff West - Quiz Section 9

CharacterList Implemented… Go ahead, implement it ;)… I don’t have slides to implement it for ya this time  Each of the top six functions is extremely important… make sure you understand how they work and why they’re there! 7/17/2001 Jeff West - Quiz Section 9

Jeff West - Quiz Section 9 What About operator+… Once again, no slide prepared to give you the answer…  Try implementing operator+ so that it will return a CharacterList that includes all of the elements in BOTH of the CharacterLists that are being added. You can assume that all characters are unique. 7/17/2001 Jeff West - Quiz Section 9

Jeff West - Quiz Section 9 Review That’s sorta up to you… ask me anything… the only email question I have received in the last four or five days was a question about the const keyword: 7/17/2001 Jeff West - Quiz Section 9