Skip to content

Ahmadjajja/Stack_using_Arrays

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stack Using Arrays

This repository contains the implementation of a Stack Data Structure using arrays in Java.

Overview

A stack is a linear data structure that follows the Last In, First Out (LIFO) principle. This means the last element inserted into the stack will be the first one to be removed.

Operations on Stack

The following operations can be performed on a stack:

  1. isEmpty() – Checks if the stack is empty.
  2. isFull() – Checks if the stack is full.
  3. push() – Inserts an element onto the stack.
  4. pop() – Removes the top element from the stack.
  5. peek() – Returns the top element without removing it.

Project Structure

This project contains two files:

  1. Stack.java

    • Implements the stack using an array.
    • Contains all the stack operations mentioned above.
  2. StackDemo.java

    • Demonstrates the usage of the Stack class.
    • Performs different stack operations.

How to Run

  1. Clone the repository.
  2. Compile the Java files:
    javac Stack.java StackDemo.java

About

Here is the lecture recording:

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages