Fat Lab Programs List
Fat Lab Programs List
if (top == 4) {
System.out.println("Stack Overflow");
return;
stack[++top] = data;
void pop() {
if (top == -1) {
System.out.println("Stack Underflow");
return;
top--;
}
void display() {
System.out.println();
class Node {
int data;
Node next;
Node top;
node.next = top;
top = node;
}
void pop() {
if (top == null) {
System.out.println("Stack Underflow");
return;
top = top.next;
void display() {
temp = temp.next;
System.out.println();
if (rear == 5) {
System.out.println("Queue Overflow");
return;
queue[rear++] = data;
void dequeue() {
if (front == rear) {
System.out.println("Queue Underflow");
return;
front++;
void display() {
class Node {
int data;
Node next;
else {
rear.next = node;
rear = node;
}
void dequeue() {
if (front == null) {
System.out.println("Queue Underflow");
return;
front = front.next;
void display() {
temp = temp.next;
System.out.println();
Ans: int binarySearch(int[] arr, int left, int right, int target) {
if (left > right) return -1;
else
quickSort(arr, pi + 1, high);
}
}
int i = low - 1;
i++;
return i + 1;
if (l < r) {
int m = (l + r) / 2;
mergeSort(arr, l, m);
mergeSort(arr, m + 1, r);
merge(arr, l, m, r);
}
int i = 0, j = 0, k = l;
arr[j + 1] = arr[j];
j--;
arr[j + 1] = key;
}
int minIdx = i;
minIdx = j;
else {
int b = stack.pop();
int a = stack.pop();
switch (c) {
case '+': stack.push(a + b); break;
return stack.pop();
if (Character.isLetterOrDigit(c)) result.append(c);
else if (c == ')') {
result.append(stack.pop());
stack.pop();
} else {
precedence.getOrDefault(stack.peek(), 0))
result.append(stack.pop());
stack.push(c);
return result.toString();