From 8a85e550aff94918516ee0eabc5f0a3181938790 Mon Sep 17 00:00:00 2001 From: "uzair.mukadam" Date: Fri, 5 Sep 2025 19:24:17 -0400 Subject: [PATCH 1/2] script added to calculate LOC and mentioned the count in doc. --- courseProjectDocs/project-proposal.md | 17 +++++++++++++-- data_structures/LOC_calc.py | 30 +++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 data_structures/LOC_calc.py diff --git a/courseProjectDocs/project-proposal.md b/courseProjectDocs/project-proposal.md index b9e0847f0dd2..02912596330e 100644 --- a/courseProjectDocs/project-proposal.md +++ b/courseProjectDocs/project-proposal.md @@ -3,7 +3,7 @@ ## Project Overview -< include overview here > +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 @@ -13,7 +13,20 @@ #### Lines of Code -< include metrics here > +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 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 From c28b032e7ace43b38a53023d62efa9e42240180a Mon Sep 17 00:00:00 2001 From: "uzair.mukadam" Date: Fri, 5 Sep 2025 19:35:29 -0400 Subject: [PATCH 2/2] LOC script removed --- data_structures/LOC_calc.py | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 data_structures/LOC_calc.py diff --git a/data_structures/LOC_calc.py b/data_structures/LOC_calc.py deleted file mode 100644 index 32b4e4889d9d..000000000000 --- a/data_structures/LOC_calc.py +++ /dev/null @@ -1,30 +0,0 @@ -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