Welcome to the Open DSA repository! This project is a collection of coding questions and solutions aimed at helping individuals prepare for data structures and algorithms (DSA) interviews. The solutions are organized by question names, and each solution should be submitted in the form of a Python file (questionname.py).
Open DSA is an open-source repository designed to facilitate the learning and practice of data structures and algorithms. Whether you are preparing for technical interviews, improving your problem-solving skills, or just learning DSA, this repo provides a structured and collaborative way to contribute and discuss solutions to common problems.
We encourage everyone to contribute solutions to the questions listed in this repository. To contribute:
-
Fork the Repository: Create a personal fork of the repo.
-
Clone the Repo: Clone your fork to your local machine.
git clone https://github.com/your-username/Open-DSA.git
-
Navigate to the Appropriate Directory: Each question has its own directory. Find the relevant question and solution template.
-
Add Your Solution: Write your solution in Python and name the file using the format:
questionname.py. For example, if you’re solving "Merge Sort," the file name should bemergesort.py. -
Push Changes: After adding your solution, push the changes to your fork.
-
Create a Pull Request: Once your changes are pushed, create a pull request for review.
Each solution should follow this format:
- File Name:
questionname.py, wherequestionnameis the name of the question or problem. - Code: Implement the algorithm/solution in Python.
- Documentation: Briefly explain the algorithm at the top of the file. Mention time and space complexity if possible.
- Test Cases: If applicable, include test cases to validate the solution.
Example:
# mergesort.py
# This file implements the Merge Sort algorithm in Python.
# Time Complexity: O(n log n)
# Space Complexity: O(n)
def merge_sort(arr):
# Implementation of merge sort algorithm
pass
if __name__ == "__main__":
# Test cases
arr = [12, 11, 13, 5, 6, 7]
print("Sorted array is:", merge_sort(arr))This repo encourages collaboration and learning. To promote this, we have a Discussion Panel where you can interact with other contributors and discuss questions, solutions, or improvements.
- Leave Comments on Pull Requests: You can provide feedback, ask questions, or suggest improvements on submitted pull requests.
- Join the Issues Section: Each question can have an associated issue for further discussion. You can ask clarifications or discuss different approaches to solving the problem.
- Engage in Discussions: Feel free to contribute to open discussions or start new ones if you have questions or insights.