GithubHelp home page GithubHelp logo

abdullahsattaar / stack-implementation-using-singly-linked-list Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 3 KB

C++ code Implementation a template-based stack using a singly linked list. Extra Global Functions: 1)StringReverse() 2)IsBalanced()

C++ 100.00%
cpp data-structures singly-linked-list stack-implementation string-reverse is-balanced

stack-implementation-using-singly-linked-list's Introduction

Stack-Implementation-using-Singly-Linked-List

C++ code Implementation a template-based stack using a singly linked list. Extra Global Functions: 1)StringReverse() 2)IsBalanced()

  1. Implement a template-based stack using a singly linked list. The required member methods are:

int size(): returns the count of total element stored in the stack. bool isEmpty(): returns true if the stack is empty else false. bool top(T&): returns, but does not delete, the topmost element from the stack via the parameter passed by reference. It returns false via a return statement if there is no element in the stack, else it returns true and assigns the top most element to the parameter passed by reference. void pop(): deletes the top most element from the stack. If there is no element, return some error. push(T const& e): pushes the element “e” on top of the stack.

Application of Stack

Write following methods in your main function 2. Given an expression containing opening and closing braces, brackets, and parentheses; implement a function “isBalanced” to check whether the given expression is a balanced expression or not, using your stack implementation. For example, {[{}{}]}[()], {{}{}}, and []{}() are balanced expressions, but {()}[) and {(}) are not balanced. In your main function test your function using the given examples. bool isBalanced(string exp)

  1. Implement a function reverse which reverses the given string using your stack data structure. string reverse(string const);

stack-implementation-using-singly-linked-list's People

Contributors

abdullahsattaar avatar

Watchers

 avatar  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.