GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - BaseMax/MyStackJava: My Stack Implementation In Java. Here we are going to design a full-featured class for Stack's Data structure.

BranchesTags
Open more actions menu

Latest commit

 

History

9 Commits
9 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE
LICENSE
 
 
MyStack.java
MyStack.java
 
 
README.md
README.md
 
 

Repository files navigation

MyStack.Java

My Stack Implementation In Java

Here we are going to design a full-featured class for Stack's Data structure.

MyStackJava Functions

  • public MyStack(int size): Create a new stack with a given size
  • public boolean push(int value): Push an element to the top of the stack and return true.
  • public int pop(): Pop an element from the top of the stack and return the value.
  • public int peek(): Peek the top value of the stack and return the value.
  • public boolean isEmpty(): Return true if the stack is empty.
  • public boolean isFull(): Return true if the stack is full.
  • public int size(): Return the size of the stack.
  • public boolean resize(int newSize): Resize the stack to a new size.
  • public void printStack(): Print the stack.

Using MyStackJava

public class HelloWorld {
    public static void main(String []args){
        System.out.println("Hello, World!");

        MyStack stack = new MyStack(5);
        stack.push(1);
        stack.push(2);
        stack.push(3);
        stack.push(4);
        stack.push(5);

        stack.printStack();

        System.out.println("Peek: " + stack.peek());
        System.out.println("Pop: " + stack.pop());
        System.out.println("Peek: " + stack.peek());

        stack.printStack();
    }
}

About

My Stack Implementation In Java. Here we are going to design a full-featured class for Stack's Data structure.

Topics

data-structuredata-structure-and-algorithmdata-structure-javadata-structuresdata-structures-algorithmsdata-structures-and-algorithmsdata-structures-interview-questionsdata-structures-javajavastack

Resources

Readme
GPL-3.0 license
Activity

Stars

1 star

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.