diff --git a/courseProjectDocs/project-proposal.md b/courseProjectDocs/project-proposal.md new file mode 100644 index 000000000000..02912596330e --- /dev/null +++ b/courseProjectDocs/project-proposal.md @@ -0,0 +1,47 @@ +# Project Proposal + + +## Project Overview + +This repository is a curated collection of algorithmic implementations in Python, designed to serve as a reference, learning resource, and toolkit for developers and students alike. It spans a wide range of domains, including blockchain, ciphers, data compressions, data structures, linear algebra, etc. + + +## Key Quality Metrics + + +### Code Structure + +#### Lines of Code + +Data Structures Directory: + +1. arrays: 871 +2. binary tree: 4992 +3. disjoint set: 129 +4. hashing: 881 +5. heap: 1310 +6. kd tree: 275 +7. linked list: 2611 +8. queues: 1246 +9. stacks: 1321 +10. suffix tree: 165 +11. trie: 289 +- #### total: 14090 + +#### Comment Density + +< include metrics here > + +#### Cyclomatic Complexity + +< include metrics here > + +### Testability + +#### Number of Unit Test Cases + +< include metrics here > + +#### Test Coverage + +< include metrics here > diff --git a/data_structures/LOC_calc.py b/data_structures/LOC_calc.py new file mode 100644 index 000000000000..32b4e4889d9d --- /dev/null +++ b/data_structures/LOC_calc.py @@ -0,0 +1,30 @@ +import os +from collections import defaultdict + +def count_python_lines(root_dir): + dir_line_counts = defaultdict(int) + total_lines = 0 + + for dirpath, _, filenames in os.walk(root_dir): + dir_total = 0 + for filename in filenames: + if filename.endswith('.py'): + file_path = os.path.join(dirpath, filename) + try: + with open(file_path, 'r', encoding='utf-8') as f: + lines = sum(1 for line in f if line.strip()) # Count non-empty lines + dir_total += lines + total_lines += lines + except Exception as e: + print(f"Error reading {file_path}: {e}") + dir_line_counts[dirpath] = dir_total + + print("\n📁 Lines of Code by Directory:") + for directory, count in sorted(dir_line_counts.items()): + print(f"{directory}: {count} lines") + + print(f"\n🧮 Total Lines of Python Code: {total_lines} lines") + +# Example usage +if __name__ == "__main__": + count_python_lines("/Users/uzairmukadam/Projects/TheAlgorithms-Python/data_structures") # Replace "." with your target root directory