A powerful, full-stack search engine designed to help competitive programmers and interview candidates find relevant Data Structures and Algorithms (DSA) problems across multiple platforms in seconds.
DSA Search Engine is a web-based application that aggregates 3,500+ coding problems from leading competitive programming platforms and provides intelligent search functionality using TF-IDF (Term Frequency-Inverse Document Frequency) algorithm for relevance-based ranking.
- Multi-Platform Aggregation: Search problems from LeetCode, Codeforces, and CodeChef
- Intelligent Search: TF-IDF based ranking for highly relevant results
- Fast Performance: Returns search results within seconds
- Responsive Design: Modern, intuitive UI with animated particle background
- Real-time Indexing: Efficient data structures for instant retrieval
- Direct Platform Links: One-click access to problem statements on original platforms
Frontend:
- HTML5 / CSS3 / Vanilla JavaScript
- Particle animation system for enhanced UX
- Responsive design with modern UI elements
Backend:
- Node.js with Express.js framework
- TF-IDF implementation using the
naturallibrary - Cosine similarity for document ranking
Data Pipeline:
- Puppeteer for web scraping
- Stopword removal for text preprocessing
- JSON-based corpus storage
βββββββββββββββββββββββββββββββββββββββββββ
β Browser (Frontend) β
β - index.html (UI) β
β - script.js (Client logic) β
β - style.css (Styling) β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β (HTTP POST)
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Express.js Backend (index.js) β
β - /search endpoint β
β - TF-IDF indexing β
β - Cosine similarity ranking β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββ
β Data Layer β
β - corpus/all_problems.json β
β - TF-IDF index & document vectors β
βββββββββββββββββββββββββββββββββββββββββββ
DSA-Search-Engine/
βββ index.html # Main frontend interface
βββ index.js # Express server & search logic
βββ script.js # Client-side search handler
βββ style.css # Styling & animations
βββ scrape.js # Web scraping pipeline
βββ package.json # Dependencies
βββ corpus/ # Problem corpus storage
β βββ all_problems.json # Aggregated problems data
βββ problems/ # Scraped problem files
βββ utils/ # Utility functions
β βββ preprocess.js # Text preprocessing
βββ assests/ # Image assets & logos
βββ .gitignore
Automated web scraping to collect problem data:
- LeetCode Scraper: Scrolls through problem list, fetches 1000+ problems with descriptions
- Codeforces Scraper: Paginates through problem set, retrieves titles, URLs, and descriptions
- Implements delays and randomization to prevent IP blocking
- Stores data in structured JSON format
// Example problem structure
{
"title": "Two Sum",
"url": "https://leetcode.com/problems/two-sum/",
"description": "Given an array of integers nums...",
"platform": "Leetcode"
}Advanced TF-IDF based search implementation:
Key Algorithms:
-
TF-IDF Vector Space Model:
- Term Frequency (TF): Frequency of term in document
- Inverse Document Frequency (IDF): Rarity of term across corpus
- Combined weight:
TF Γ IDF
-
Cosine Similarity: Measures angle between query and document vectors
Similarity = (Query Β· Document) / (||Query|| Γ ||Document||) -
Title Boosting: Problem titles duplicated to increase relevance weight
Performance Optimizations:
- Pre-computed document vectors cached in memory
- Document magnitude pre-calculated for faster similarity computation
- Returns top 30 results filtered by relevance score > 0
Standardizes queries and documents:
- Lowercase conversion
- Stopword removal (the, a, is, etc.)
- Tokenization
- Special character handling
User Experience Features:
- Clean, minimalist search interface
- Real-time platform logo display (LeetCode, Codeforces, CodeChef)
- Animated particle background with network visualization
- Loading spinner during search
- Responsive results display with platform badges
- Direct links to problem sources
- Node.js (v14 or higher)
- npm or yarn
- Chrome/Chromium browser (for web scraping)
# Clone the repository
git clone https://github.com/Dan948142/DSA-Search-Engine.git
cd DSA-Search-Engine
# Install dependencies
npm installNo additional configuration needed for basic usage.
# Start the server
npm start
# Server runs on http://localhost:3000
# Open in browser and start searching!# Scrape latest problems from platforms
npm run scrape
# This generates:
# - problems/leetcode_problems.json
# - problems/codeforces_problems.json
# Merge all problem files
npm run merge
# Start the server with fresh data
npm startTry these queries in the search box:
two sum- Basic array problemsdynamic programming- DP problemsbinary tree- Tree data structuresgreedy- Greedy algorithm problemshash map- Hashing problems
- Query Input: User enters search query
- Preprocessing: Query is lowercased, tokenized, stopwords removed
- TF-IDF Computation: Query vector computed using corpus vocabulary
- Cosine Similarity: Query vector compared against all document vectors
- Ranking: Results sorted by similarity score (descending)
- Display: Top 30 results shown with platform information
Example Flow:
User Input: "two sum problem"
β
Preprocessed: ["two", "sum"] (stopwords removed)
β
TF-IDF Scores Computed
β
Cosine Similarity with all documents
β
Top Results:
1. Two Sum (Leetcode) - Score: 0.92
2. Two Sum II (Leetcode) - Score: 0.85
3. Sum of Two Numbers (Codeforces) - Score: 0.78
| Metric | Value |
|---|---|
| Total Problems Indexed | 3,500+ |
| Search Response Time | < 1 second |
| Search Results Returned | Top 30 |
| Index Build Time | ~5-10 seconds on startup |
| Memory Usage | ~50-100 MB |
{
"express": "^5.1.0", // Web framework
"natural": "^8.1.0", // TF-IDF, NLP utilities
"puppeteer": "^24.10.2", // Web scraping
"stopword": "^3.1.5" // Stopword removal
}This project demonstrates:
- Data Structures: Vectors, Hash Maps for efficient search
- Algorithms: TF-IDF ranking, Cosine similarity
- Backend Development: Express.js server, API design
- Web Scraping: Puppeteer automation, handling dynamic content
- Frontend Development: DOM manipulation, async operations
- Full-Stack Integration: End-to-end data pipeline
- Performance Optimization: Caching, pre-computation
- Add CodeChef problem integration
- Implement problem difficulty filtering
- Add problem solving statistics per user
- Advanced filters (topic, company tags, difficulty)
- Problem recommendation engine
- Database integration (MongoDB/PostgreSQL)
- Docker containerization
- CI/CD pipeline
- Unit and integration tests
- API rate limiting and caching
This project is licensed under the MIT License - see the LICENSE file for details.
Sanskar Sovitkar
β If you found this helpful, please consider giving it a star!