Slide 1

Slide 1 text

jgs CSE 205 Object-Oriented Programming and Data Structures Lecture 19: Stack and Queue Dr. Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment

Slide 2

Slide 2 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 2 jgs Homework 04 This assignment is about implementing (from Scratch) the Classes MyNode, MyList, MyStack, and MyQueue. These classes should be Generic, i.e., use parametrized types. Implement the following methods: a) For MyList: instertFirst(), insertAt(), insertLast(), removeFirst(), removeAt(), removeLast(), printAll() b) For MyStack: push(), pop() c) For MyQueue: enqueue(), dequeue() Finally, create a Class Main with a method main() in which you a) create objects MyList, MyStack and MyQueue with data of type String. Insert, remove and print elements using your methods. Test all of them. b) reuse a class Student or Triangle or similar from previous assignments and create objects MyList, MyStack and MyQueue with data of that type. Insert, remove and print elements using your methods. Test all of them. Total Number of Classes to submit: ~7

Slide 3

Slide 3 text

jgs Previously

Slide 4

Slide 4 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 4 jgs I introduce you a List, a Linked List

Slide 5

Slide 5 text

jgs Stack

Slide 6

Slide 6 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 6 jgs I introduce you a List, a Linked List

Slide 7

Slide 7 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 7 jgs I introduce you a List, a Linked List

Slide 8

Slide 8 text

jgs Queue

Slide 9

Slide 9 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 9 jgs I introduce you a List, a Linked List

Slide 10

Slide 10 text

jgs Homework

Slide 11

Slide 11 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 11 jgs Homework 04 This assignment is about implementing (from Scratch) the Classes MyNode, MyList, MyStack, and MyQueue. These classes should be Generic, i.e., use parametrized types. Implement the following methods: a) For MyList: instertFirst(), insertAt(), insertLast(), removeFirst(), removeAt(), removeLast(), printAll() b) For MyStack: push(), pop() c) For MyQueue: enqueue(), dequeue() Finally, create a Class Main with a method main() in which you a) create objects MyList, MyStack and MyQueue with data of type String. Insert, remove and print elements using your methods. Test all of them. b) reuse a class Student or Triangle or similar from previous assignments and create objects MyList, MyStack and MyQueue with data of that type. Insert, remove and print elements using your methods. Test all of them. Total Number of Classes to submit: ~7

Slide 12

Slide 12 text

Javier Gonzalez-Sanchez | CSE205 | Fall 2021 | 12 jgs Questions

Slide 13

Slide 13 text

jgs CSE 205 Object-Oriented Programming and Data Structures Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall 2021 Copyright. These slides can only be used as study material for the class CSE205 at Arizona State University. They cannot be distributed or used for another purpose.