Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Peek

Sumit Rawal answered on May 18, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers

  • knitr

  • Peek

    0

    Another thing that we can do is view the top element of the stack so we can ask the data structure: “What’s the top element?” and it can give that to us using the peek operation. Note that the peek operation does not remove the top element, it merely returns it.

    We can also check whether or not the stack is empty, and a few other things too, that will come along the way as we implement it.

    Now I’m going to create a stack class, and the constructor of the class is going to initialize a Python list. The Python list has a lot of things that we’re after, and it’s going to make it easier for us to tweak Python’s implementation of the list to be adapted to what we would expect to see in a stack, namely, push/pop.

    Popularity 1/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: peek whatever
    Link to this answer
    Share Copy Link
    Contributed on May 18 2023
    Sumit Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.