This repository contains a collection of C programs that I prepared while learning data structures. The programs cover various fundamental and advanced concepts, providing hands-on experience with data structures and algorithms in C.
- Pattern Matching Algorithms
- Array Operations
- Sorting Algorithms
- Linked List Operations
- Stack Operations
- Queue Operations and Sorting
- Binary Tree Operations
- Binary Search and Related Problems
- Tree Construction
- Pattern Matching Algorithm
- Implements basic pattern matching in a string.
- Pattern Matching Algorithm (Optimized)
- Improved version with better complexity.
- Insert Element into Array
- Inserts an element at a specified position in an array.
- Delete Element from Array
- Deletes an element at a specified position in an array.
- Binary Search
- Finds the position of a specified element in a sorted array.
- Insertion Sort
- Sorts an array of integers in ascending order.
- Kth Largest Element
- Finds the Kth largest element in an array.
- Relative Sort Array
- Sorts an array relative to another array.
- Sort Array by Parity
- Sorts an array, grouping even numbers before odd numbers.
- Print Linked List
- Prints all elements in a linked list.
- Insert Node
- Inserts a node at the beginning or end of a linked list.
- Delete Node
- Deletes a node with a specific value.
- Add Value to Elements
- Adds a given value K to each element in a linked list.
- Stack Implementation
- Implements a stack using a linear array.
- Postfix Expression Evaluation
- Evaluates a postfix expression using a stack.
- Infix to Postfix Conversion
- Converts an infix expression to a postfix expression using a stack.
- Queue Implementation
- Implements enqueue and dequeue operations.
- Pre-order Traversal
- Implements pre-order traversal of a binary tree.
- Quick Sort
- Sorts an array using the Quick Sort algorithm.
- In-order Traversal
- Implements in-order traversal of a binary tree.
- Post-order Traversal
- Implements post-order traversal of a binary tree.
- Search and Insert in BST
- Searches and inserts elements in a Binary Search Tree (BST).
- Binary Search
- Efficiently searches for a target element in a sorted array.
- First and Last Occurrences
- Finds the first and last occurrences of a target in a sorted array.
- Insert Position
- Determines the appropriate insert position for a target in a sorted array.
- Peak Element
- Identifies a peak element in an array using Binary Search.
- Construct Tree from Traversals
- Constructs a tree from given In-order and Pre-order traversals.
-
Clone the repository:
git clone https://github.com/your-username/your-repo-name.git
-
Navigate to the directory:
cd your-repo-name -
Compile and run any program:
gcc filename.c -o output ./output
Contributions are welcome! If you have suggestions for improvements or new programs to add, feel free to submit a pull request.
Happy Coding!😊