diff --git a/README.md b/README.md
index 2068996..c2e1722 100644
--- a/README.md
+++ b/README.md
@@ -1,90 +1,228 @@
-# TypeScript Algorithms and Data Structures
+# 🚀 TypeScript Algorithms and Data Structures
-This repository is a collection of TypeScript algorithms and data structures. It is intended for educational purposes and serves as a reference for developers who want to learn and practice TypeScript.
+**A comprehensive collection of algorithms, data structures, and coding challenges implemented in TypeScript**
-
-[](https://app.codacy.com/gh/behzadam/algorithms/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
-
+[](https://github.com/behzadam/algorithms)
+[](https://app.codacy.com/gh/behzadam/algorithms/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
+[](https://github.com/behzadam/algorithms)
+[](https://opensource.org/licenses/MIT)
-## Introduction
+[Features](#-features) • [Quick Start](#-getting-started) • [Documentation](#-documentation)
-It includes code and patterns from the "JavaScript Algorithms" repository, translated from JavaScript to TypeScript. [JavaScript Algorithms](https://github.com/trekhleb/javascript-algorithms)
+---
-## Data structure
+## 📋 Table of Contents
-- [HashTable](src/data-structure/hash-table/hash-table.ts)
-- [MinHeap](src/data-structure/heap/min-heap.ts)
-- [MaxHeap](src/data-structure/heap/max-heap.ts)
-- [LinkedList](src/data-structure/linked-list/linked-list.ts)
-- [Queue](src/data-structure/queue/queue.ts)
-- [Stack](src/data-structure/stack/stack.ts)
-- [MaxPriorityQueue](src/data-structure/priority-queue/max-priority-queue.ts)
-- [MinPriorityQueue](src/data-structure/priority-queue/min-priority-queue.ts)
-- [Trie](src/data-structure/trie/trie.ts)
+
+
+Click to expand
+
-## Algorithms
+- [🚀 TypeScript Algorithms and Data Structures](#-typescript-algorithms-and-data-structures)
+ - [📋 Table of Contents](#-table-of-contents)
+ - [🎯 Introduction](#-introduction)
+ - [✨ Features](#-features)
+ - [📚 Documentation](#-documentation)
+ - [📦 Data Structures](#-data-structures)
+ - [🔍 Algorithms](#-algorithms)
+ - [🔎 Search Algorithms](#-search-algorithms)
+ - [🔄 Sorting Algorithms](#-sorting-algorithms)
+ - [💻 Coding Challenges](#-coding-challenges)
+ - [👉 Two Pointers](#-two-pointers)
+ - [🛠️ Utilities](#️-utilities)
+ - [🚀 Getting Started](#-getting-started)
+ - [Prerequisites](#prerequisites)
+ - [Installation](#installation)
+ - [💻 Development](#-development)
+ - [Available Scripts](#available-scripts)
+ - [Project Structure](#project-structure)
+ - [📝 License](#-license)
+ - [📧 Contact](#-contact)
-### Search
+
+
+
-- [BinarySearch](src/algorithms/search/binary-search/binary-search.ts)
-- [LinearSearch](src/algorithms/search/linear-search/linear-search.ts)
+---
-### Sort
+## 🎯 Introduction
-- [QuickSort](src/algorithms/sort/quick-sort/quick-sort.ts)
-- [BubbleSort](src/algorithms/sort/bubble-sort/bubble-sort.ts)
-- [BubbleSortSimple](src/algorithms/sort/bubble-sort/bubble-sort-simple.ts)
+This repository is a **comprehensive collection** of TypeScript algorithms and data structures designed for educational purposes. It serves as a reference for developers who want to learn, practice, and master TypeScript while understanding fundamental computer science concepts.
-## Utils
+> 💡 **Note:** This repository includes code and patterns from the [JavaScript Algorithms](https://github.com/trekhleb/javascript-algorithms) repository, translated and enhanced from JavaScript to TypeScript.
-- [Comparator](src/ds/comparator/comparator.ts)
+---
-Please note that the repository is still a work in progress, and new algorithms and patterns will be added over time.
+## ✨ Features
-## Getting Started
+- 🔍 **Well-documented** code with TypeScript types
+- ✅ **Fully tested** with Jest test suites
+- 📚 **Educational** focus with clear implementations
+- 🎨 **Clean code** following best practices
+- 🚀 **Production-ready** implementations
+- 🔄 **Regularly updated** with new algorithms and patterns
-To get started with the repository, follow these simple steps:
+---
-Clone the repository to your local machine using the command:
+## 📚 Documentation
-```bash
-git clone https://github.com/behzadam/algorithms.git
-```
+### 📦 Data Structures
-Install the required dependencies by running the following command:
+| Data Structure | Description | Implementation |
+| -------------------- | ------------------------------------ | -------------------------------------------------------------------- |
+| **HashTable** | Key-value mapping with hash function | [View Code](src/data-structure/hash-table/hash-table.ts) |
+| **MinHeap** | Binary heap with minimum root | [View Code](src/data-structure/heap/min-heap.ts) |
+| **MaxHeap** | Binary heap with maximum root | [View Code](src/data-structure/heap/max-heap.ts) |
+| **LinkedList** | Linear collection of nodes | [View Code](src/data-structure/linked-list/linked-list.ts) |
+| **Queue** | FIFO (First In First Out) structure | [View Code](src/data-structure/queue/queue.ts) |
+| **Stack** | LIFO (Last In First Out) structure | [View Code](src/data-structure/stack/stack.ts) |
+| **MaxPriorityQueue** | Priority queue with max priority | [View Code](src/data-structure/priority-queue/max-priority-queue.ts) |
+| **MinPriorityQueue** | Priority queue with min priority | [View Code](src/data-structure/priority-queue/min-priority-queue.ts) |
+| **Trie** | Prefix tree for string operations | [View Code](src/data-structure/trie/trie.ts) |
+| **BinaryTree** | Hierarchical tree structure | [View Code](src/data-structure/tree/binary-tree.ts) |
-```bash
-pnpm install
-```
+### 🔍 Algorithms
+
+#### 🔎 Search Algorithms
+
+- **[Binary Search](src/algorithms/search/binary-search/binary-search.ts)** - Efficient search in sorted arrays
+- **[Linear Search](src/algorithms/search/linear-search/linear-search.ts)** - Simple sequential search
+
+#### 🔄 Sorting Algorithms
+
+- **[Quick Sort](src/algorithms/sort/quick/quick-sort.ts)** - Divide and conquer sorting algorithm
+- **[Bubble Sort](src/algorithms/sort/bubble-sort/bubble-sort.ts)** - Simple comparison-based sort
+- **[Bubble Sort Simple](src/algorithms/sort/bubble-sort/bubble-sort-simple.ts)** - Simplified bubble sort implementation
+
+### 💻 Coding Challenges
+
+#### 👉 Two Pointers
+
+- **[Pair Sum Sorted](src/code-challanges/two-pointers/pair-sum-sorted.ts)** - Find pairs in sorted array that sum to target
+
+### 🛠️ Utilities
+
+- **[Comparator](src/utils/comparator.ts)** - Comparison functions for sorting and searching
+- **[Range](src/utils/range.ts)** - Utility for generating number ranges
+- **[Type Definitions](src/types/)** - Common TypeScript type definitions
+
+---
+
+## 🚀 Getting Started
+
+### Prerequisites
+
+- **Node.js** (v16 or higher)
+- **pnpm** (or npm/yarn)
+
+### Installation
+
+1. **Clone the repository**
+
+ ```bash
+ git clone https://github.com/behzadam/algorithms.git
+ cd algorithms
+ ```
+
+2. **Install dependencies**
+
+ ```bash
+ pnpm install
+ ```
+
+3. **Run tests**
+
+ ```bash
+ pnpm test
+ ```
-Run all tests
+---
+
+## 💻 Development
+
+### Available Scripts
+
+
+
+Test Commands
+
```bash
+# Run all tests
pnpm test
-```
-Format checking
+# Run tests in watch mode
+pnpm test:watch
-```bash
-pnpm format:check
+# Run tests with coverage
+pnpm test:coverage
```
-Format fixing
+
+
+
+
+Code Quality Commands
+
```bash
-pnpm format:fix
-```
+# Check code formatting
+pnpm format:check
-Run ESLint
+# Fix code formatting
+pnpm format:fix
-```bash
+# Run ESLint
pnpm lint
+
+# Fix ESLint issues
+pnpm lint:fix
+```
+
+
+
+
+
+### Project Structure
+
+```text
+algorithms/
+├── src/
+│ ├── algorithms/ # Algorithm implementations
+│ │ ├── search/ # Search algorithms
+│ │ └── sort/ # Sorting algorithms
+│ ├── code-challanges/ # Coding challenges
+│ ├── data-structure/ # Data structure implementations
+│ ├── types/ # TypeScript type definitions
+│ └── utils/ # Utility functions
+├── jest.config.js # Jest configuration
+├── tsconfig.json # TypeScript configuration
+└── package.json # Project dependencies
```
-## License
+---
+
+## 📝 License
+
+This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
+
+---
+
+## 📧 Contact
+
+Have questions or suggestions? Feel free to reach out!
+
+- **Email:** [behzad.am@gmail.com](mailto:behzad.am@gmail.com)
+- **GitHub:** [@behzadam](https://github.com/behzadam)
+
+---
+
+
+
-The "TypeScript Algorithms, Data Structures and Patterns" repository is licensed under the [MIT License](https://opensource.org/licenses/MIT). Feel free to use, modify, and distribute the code as per the terms of the license.
+**⭐ Star this repo if you find it helpful!**
-## Contact
+Made with ❤️ by [behzadam](https://github.com/behzadam)
-If you have any questions or suggestions regarding the repository, please feel free to [contact me](mailto:behzad.am@gmail.com).
+
+
diff --git a/src/code-challanges/two-pointers/pair-sum.test.ts b/src/code-challanges/two-pointers/pair-sum-sorted.test.ts
similarity index 72%
rename from src/code-challanges/two-pointers/pair-sum.test.ts
rename to src/code-challanges/two-pointers/pair-sum-sorted.test.ts
index 2979ec4..a9ea3b4 100644
--- a/src/code-challanges/two-pointers/pair-sum.test.ts
+++ b/src/code-challanges/two-pointers/pair-sum-sorted.test.ts
@@ -1,6 +1,6 @@
-import { pairSumSortedBruteForce } from "./pair-sum";
+import { pairSumSorted } from "./pair-sum-sorted";
-describe("pairSumSortedBruteForce", () => {
+describe("pairSumSorted", () => {
it.each([
{
input: [],
@@ -25,7 +25,7 @@ describe("pairSumSortedBruteForce", () => {
])(
"returns $expected for input $input and target $target",
({ input, target, expected }) => {
- expect(pairSumSortedBruteForce(input, target)).toEqual(expected);
+ expect(pairSumSorted(input, target)).toEqual(expected);
}
);
});
diff --git a/src/code-challanges/two-pointers/pair-sum.ts b/src/code-challanges/two-pointers/pair-sum-sorted.ts
similarity index 92%
rename from src/code-challanges/two-pointers/pair-sum.ts
rename to src/code-challanges/two-pointers/pair-sum-sorted.ts
index aaa5393..2092495 100644
--- a/src/code-challanges/two-pointers/pair-sum.ts
+++ b/src/code-challanges/two-pointers/pair-sum-sorted.ts
@@ -11,7 +11,7 @@
* The time complexity of this solution is O(n) because we are using two pointers to traverse the array.
* The space complexity is O(1) because we are not using any extra space.
*/
-function pairSumSortedBruteForce(arr: number[], target: number) {
+export function pairSumSorted(arr: number[], target: number) {
let left = 0;
let right = arr.length - 1;
while (left < right) {
@@ -32,5 +32,3 @@ function pairSumSortedBruteForce(arr: number[], target: number) {
}
return [];
}
-
-export { pairSumSortedBruteForce };