This repository provides implementations of basic Data Structures and Algorithms in PHP. The folder structure is organized for better clarity and scalability, making it easy to find and run examples for specific topics.
Data Structures and Algorithms are essential for writing efficient, scalable, and optimized code. This repository demonstrates these concepts using PHP, showcasing how PHP can be used beyond web development for algorithmic and computational tasks.
.
├── data_structures/
│ ├── Stack.php
│ ├── Queue.php
│ ├── LinkedList.php
│
├── algorithms/
│ ├── Sorting/
│ │ ├── BubbleSort.php
│ │
│ ├── Searching/
│ │ ├── BinarySearch.php
│ │
│ ├── Graph/
│ ├── (Coming Soon)
data_structures/
: Contains implementations of foundational data structures.algorithms/
: Contains categorized subdirectories for different types of algorithms:Sorting/
: Sorting algorithms like Bubble Sort.Searching/
: Searching algorithms like Binary Search.Graph/
: Graph-related algorithms (coming soon).
- Stack (LIFO): A linear data structure where the last element added is the first one removed.
- Queue (FIFO): A linear data structure where the first element added is the first one removed.
- Linked List: A dynamic structure made of nodes, where each node points to the next.
- Bubble Sort: A simple sorting algorithm that repeatedly compares adjacent elements and swaps them if needed.
- Binary Search: An efficient algorithm for finding a value in a sorted array.
Coming Soon: Algorithms like Depth-First Search (DFS) and Breadth-First Search (BFS) will be added here.
The repository will be expanded to include:
- Advanced Data Structures:
- Binary Search Trees
- Hash Tables
- Graphs
- More Algorithms:
- Quick Sort
- Merge Sort
- Depth-First Search (DFS)
- Breadth-First Search (BFS)
- Clone the repository:
git clone https://github.com/kimmyxpow/php-dsa.git
- Navigate to the project directory:
cd php-dsa
- Run the examples for a specific data structure or algorithm:
php data_structures/Stack.php php algorithms/Sorting/BubbleSort.php php algorithms/Searching/BinarySearch.php
Contributions are welcome! If you'd like to add new algorithms, improve existing ones, or fix issues, feel free to:
- Fork the repository.
- Create a new branch.
- Submit a pull request.
This project is licensed under the MIT License. See the LICENSE
file for details.