GithubHelp home page GithubHelp logo

mstacks's Introduction

mStacks

MStacks class: Four variables are assigned. Stacks keep how many stacks there are in the array, indexofTops keeps the top numbers of each stack, lenghStack keeps how many numbers there are in each stack and stacksize keeps the size of stacks.

isFull function compares stacksize and lenghstack if it reaches max it returns true.

isEmpty function returns true if lenghstack is -1.

push method, The value is which will be added and the number of stacks comes as the parameter. İsFull function controls the stack if it is full it prints the stack is overflow if it is not it adds value then it increases 1 lenghstack and indexofTop.

pop method, Value is being entered and the number of stacks to take it out. Stack is controlled by isempty function. İf it is empty it prints “stack is empty” then returns null. If it is not indexofTop and lengthStack reduces 1 and the value returns from the stack which is wanted.

Main class: To create stacks in an array, first, we create an object and decide how many stacks are able to be in an array. Then push numbers to stacks, which number should be which stack it is being decided here, if it is over your stack density (according to our example 3) it will show “Stacks are overflow.” And it will just print the first three of them for each stack. So we can implement m number stacks using one array.

mstacks's People

Contributors

bilal-ayakdas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.