Select the correct option to test your answer:
Computer
Stacks In Data Structures
Difficulty: Medium
What is the time complexity of the following code? public boolean isBalanced(String exp) { int len = exp.length(); Stack<Integer> stk = new Stack<Integer>(); for(int i = 0; i < len; i++) { char ch = exp.charAt(i); if (ch == '(') stk.push(i); else if (ch == ')') { if(stk.peek() == null) { return false; } stk.pop(); } } return true; }
More Computer Questions
The variable used to set table alias names as non case sensitive is . . . . . . . .
Which of the following Media Query determines if output is grid, like a simple terminal or phone, or bitmap, like a standard monitor or printer?
What is the solution to the absence of a script tag without an src attribute?
Which server mode value disables use of built in function names as identifiers?
The value obtained in the function is given back to main by using . . . . . . . . keyword.