stack implementation error in brackets problem

I am solving a LeetCode problem 20. Valid Parentheses: Given a string s containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[‘ and ‘]’, determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the… Read More stack implementation error in brackets problem

How could I go about implementing both a stack and linked list in a program that tracks books in a library in c++

I am very new to programming and currently undertaking a programming degree, I’m required to create a simple library management system using both a linked list and a stack in c++ I can probably make the whole system using just a linked list and a class that stores the book details but the TA demands… Read More How could I go about implementing both a stack and linked list in a program that tracks books in a library in c++

Stack using doubly linked list for the first time in C, with no printing

I have implemented my stack using doubly linked list and I don’t know why it’s not printing, I think it has something to do with the right C syntax or something? #include <stdio.h> #include <stdlib.h> typedef struct Node { int data; struct Node* prev; struct Node* next; } Node; //———————Stack——————— typedef struct Stack { int… Read More Stack using doubly linked list for the first time in C, with no printing

All things inherited the same class, but some of them dont work as excepted

I have a stack to store all objects with base panel class private Stack<BasePanel> stackPanels; then I have different panels all inherited BasePanel. inside they all have a method call public virtual void OnExit() { Debug.Log("UITypeName= "+UIType.Name); UIManage.DestoryUI(UIType); } Then I trigger the Onexit method in the object using the first object in the stack.… Read More All things inherited the same class, but some of them dont work as excepted

Why is my split method is not functioning as intended when I am splitting numbers from operator

Output of the code public class Model { private Scanner sc = new Scanner(System.in); private String expression; private String exp[]; public Model() { expression = sc.nextLine(); split(); } public void split() { //splitting the entered expression to array of operators alone and array of the numbers then create Arraylist to combine the operators and numbers… Read More Why is my split method is not functioning as intended when I am splitting numbers from operator

Stack python function debugging issue

I have implemented the stack in python code. class stack: arrlen = 0 def __init__(self,arr,poin): self.arr = arr self.poin = poin arrlen = len(self.arr) def push(obj): self.poin = (self.poin+1)%arrlen self.arr[self.poin] = obj def pop(): self.poin = (self.poin-1)%arrlen def printStack(): for i in range(self.poin): print("",self.arr[i]) print("\n") I am try to run this code: x = int(input("Hello.Please… Read More Stack python function debugging issue