Home Reference Source
import {Stack} from 'dsa-gfg/src/stack/stack.ts'
public class | source

Stack

this is Stack Class.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

arr: *[]

public

top: *

Method Summary

Public Methods
public

This method will return if stack is empty or not

public

pop(): *

The method pop which will return the top element from the stack

public

push(a: T)

The method push to push element into the stack

public

This will return the size of the stack

public

values(): *

This function returns the values in a stack

Public Constructors

public constructor() source

Public Members

public arr: *[] source

public top: * source

Public Methods

public isEmpty(): boolean source

This method will return if stack is empty or not

Return:

boolean

public pop(): * source

The method pop which will return the top element from the stack

Return:

*

public push(a: T) source

The method push to push element into the stack

Params:

NameTypeAttributeDescription
a T

public size(): number source

This will return the size of the stack

Return:

number

public values(): * source

This function returns the values in a stack

Return:

*