[go: up one dir, main page]

0% found this document useful (0 votes)
7 views2 pages

Datastructures Programs

The document lists various programming challenges and algorithms, including array manipulation, linked list operations, tree traversals, graph algorithms, and sorting techniques. Each item outlines a specific problem or task, such as reversing an array, finding the maximum product subarray, and implementing an LRU cache. The challenges cover a wide range of data structures and algorithms, suitable for enhancing coding skills.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Datastructures Programs

The document lists various programming challenges and algorithms, including array manipulation, linked list operations, tree traversals, graph algorithms, and sorting techniques. Each item outlines a specific problem or task, such as reversing an array, finding the maximum product subarray, and implementing an LRU cache. The challenges cover a wide range of data structures and algorithms, suitable for enhancing coding skills.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Programs :

1. Reverse an array without using extra space


2. Find the maximum product subarray
3. Longest substring without repeating characters
4. Rotate an array (using reversal algorithm or deque)
5. Detect and remove loop in a linked list
6. Merge two sorted linked lists
7. Reverse a linked list recursively
8. LRU Cache using Linked List + HashMap
9. Implement a queue using two stacks
10.Evaluate a postfix expression
11.Find the next greater element for each element in array (use stack)
12.Sliding window maximum (Deque/Heap approach)
13.Inorder / Preorder / Postorder traversal
14.Check if a binary tree is balanced
15.Convert Binary Tree to DLL
16.Lowest Common Ancestor (LCA) in BST
17.BFS and DFS traversal
18.Detect cycle in an undirected/directed graph
19.Number of islands (matrix-based DFS)
20.Dijkstra’s algorithm (basic priority queue implementation)
21.N-Queens problem
22.Subsets and permutations generation
23.Sudoku Solver
24.Word Search in a matrix
25.Binary Search variations (first/last occurrence)
26.Merge Sort & QuickSort (recursive implementation)
27.Kth largest element using heap
28.Count Inversions using Merge Sort
29.Implement a function to check if a binary tree is balanced.
30.Write code to find the first non-repeating character in a string.
31.Implement an LRU (Least Recently Used) Cache.
32.Given a 2D matrix of 1s and 0s, count the number of islands (connected
1s)
33.Implement a function to detect a cycle in a directed graph using DFS.
34.Given an array and a target, return indices of the two numbers that add up
to the target
35.Reorder a linked list such that nodes follow first-last-second-
secondLast... pattern.
36.Use Min Heap to merge multiple sorted linked lists
37.Use HashMap + Heap to find the most frequent k elements.
38.Use binary search to find a peak element in an array.
39.Count the number of subarrays that sum to a given value.
40.Given a reference to a node, return a deep copy of the entire graph.
41.Given an unsorted array, find the length of the longest consecutive
elements sequence in O(n) time.

42.Clone Graph - Given a reference to a node, return a deep copy of the


entire graph.
43.Course Schedule (Topological Sort) - Determine if you can finish all
courses given prerequisites.
44.Median of Two Sorted Arrays - Efficient merge logic with
O(log(min(n,m))) complexity.
45.Trapping Rain Water - Find water units trapped after raining using two-
pointer or stack approach.
46.Frequency of Elements in Array - Count how many times each element
appears using a dictionary.
47.Zigzag String Conversion - Print a string in a zigzag pattern given a
number of rows.
48.Sum of Nodes with Only One Child in Binary Tree - Traverse the tree
and sum the value of nodes having exactly one child.
49.Find Missing Number in Array - Given n-1 numbers from 1 to n, find
the missing one.
50.Spiral Order Matrix Traversal - Print a 2D matrix in spiral (clockwise)
order.

You might also like