Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSE205 Lecture 19

CSE205 Lecture 19

Object-Oriented Programming and Data Structures
Stack and Queue
(202204)

Javier Gonzalez-Sanchez
PRO

September 29, 2021
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. 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

    View Slide

  2. 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

    View Slide

  3. jgs
    Previously

    View Slide

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

    View Slide

  5. jgs
    Stack

    View Slide

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

    View Slide

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

    View Slide

  8. jgs
    Queue

    View Slide

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

    View Slide

  10. jgs
    Homework

    View Slide

  11. 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

    View Slide

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

    View Slide

  13. 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.

    View Slide