Programming Questions (Data Structures)
1. Arrays
a) Implement a function to find the maximum and minimum values in an
integer array.
b) Write a function to reverse an array in place.
c) Given an array of integers, find the two numbers such that their sum is
closest to a target value.
d) Implement a function to remove duplicates from a sorted array.
e) Given an array of integers, find the subarray with the maximum sum.
2. Linked Lists
a) Write a function to reverse a singly linked list.
b) Implement a function to detect a cycle in a linked list.
c) Given two sorted linked lists, merge them into a single sorted linked
list.
d) Implement a function to find the middle node of a linked list.
e) Given the heads of two singly linked lists, determine if they intersect. If
so, return the intersecting node.
3. Stacks
a) Implement a stack using an array.
b) Implement a stack using a linked list.
c) Evaluate a postfix expression using a stack.
d) Implement a function to check if parentheses in an expression are
balanced.
e) Design a data structure that supports push, pop, and min operations in
constant time.
4. Queues
a) Implement a queue using an array.
b) Implement a queue using a linked list.
c) Implement a function to reverse a queue.
d) Implement a breadth-first search (BFS) algorithm using a queue.
e) Design a queue that supports getting the minimum value in constant
time.
5. Trees
a) Implement a function to perform in-order traversal of a binary tree.
b) Implement a function to perform level-order traversal of a binary tree.
c) Implement a function to check if a given binary tree is a binary search
tree.
d) Implement a function to find the lowest common ancestor of two nodes
in a binary tree.
e) Implement a function to find the maximum depth of a binary tree.