-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comparing Data Structures #401
Comments
It would to good to discuss, how to show this comparison? A document? And all the metrics that can be used to compare data structures. Some initial metrics (CRUD):
|
I was wondering if we can compare the common methods of two data structures or algorithms. Technically, what I mean is that comparing two APIs which perform the same function. Say, for example if we want to compare two trees, AVL Tree and Red Black Tree, then there are two classes in Say there is a class, Let me know what you think. |
Yes that's very accurate. I do have few more points that we can talk about:
Thoughts on this? |
Agreed. In fact that would help in making the APIs consistent.
We can discuss and document the design here in this thread. We can edit the original post with the final design.
Yes. We can show that in JSON format for each data structure. For two arguments the comparison would be more detailed (ratios, which one is how much percent better than the other, etc.) and for multiple ones, we can just sort the data structures with respect to the time and space of each common method. For example if there are 3 common methods between ds1, ds2 and ds3 then, we would receive, 3 x 2 orders for each common method's time and space. Anyways, this is just speculation, once we start implementing it the output format will become more clear.
Agreed. |
Hi, In order to compare data structures, it is essential to give the features or functions which are not in one of the data structures. I think that we can compare the data structures on the basic operations such as insertion, deletion, traversing to get element at a position and extra operations that can be done by one data structure which other can't with the same dataset with its time and space. Any suggestions or thoughts on this? |
I think comparison should be done for the set of operations which are common to both the data structures. If nothing is common then an empty JSON output along with a warning that no operation is common between the desired data structures. |
Hi @sjathinI am interested in working on this issue as part of my contribution to PyDataStructs. I have reviewed the requirements and would like to propose the following approach for implementing the Comparing Data Structures feature. Proposed ApproachDefine Comparison MetricsTo effectively compare data structures, I plan to implement the following key metrics:
API DesignI propose creating a function-based API for ease of use: def compare_data_structures(ds1, ds2, operations, num_elements=1000):
"""
Compare two data structures based on execution time and memory usage.
Parameters:
ds1, ds2: Data structure instances to compare.
operations: List of operations to benchmark (e.g., ['insert', 'search']).
num_elements: Number of elements to test performance with.
Returns:
A dictionary containing comparison results.
""" DocumentationI will add:
Next StepsBefore starting, I would love to get your feedback on this approach. Do you have any suggestions or additional requirements? Best,
|
Hi @sjathin , I was thinking about how we could make the Comparing Data Structures feature even more user-friendly. in addition to running comparisons in a script, what if we develop a VS Code extension where users can:
** Proposed Implementation**
Would love to hear your thoughts on this! Do you think this could be a useful enhancement? Best, |
Hello, @sjathin myself khadar I have done GSOC'24 in Sugar Labs I would love to contribute to this project Thank you |
User @Ahmed-Gamal24 has already laid out a solid approach that serves the purpose well. However, I believe there are a few key areas that could be improved: Identified Gaps & Proposed Fixes- No Support for Edge Cases in Data The current approach doesn't test various data distributions (sorted, reverse-sorted, duplicate-heavy, sparse, dense). Fix: Introduce a Mutation Testing Mode to evaluate data structures under different conditions. Limited Metrics for Comparison
Fix: Extend metrics to include these additional performance factors. Additionally, I’d like to highlight my experience in the required tech stack, ensuring I can implement all the functionalities proposed by User @Ahmed-Gamal24 with high quality and robustness. Would love to hear your thoughts on these additions. |
Also I thought of some features around the same problem, I know these features might seem ambitious, but I’d love to get everyone's feedback. If any of these enhancements sound significant and worth exploring, please let me know. Proposed Advanced Features Instant Performance Profiling in IDEs
Adaptive Benchmarking Mode
Visual Performance Reports
Looking forward to your thoughts. Let me know if any feature should be explored further. |
Description of the problem
Feature Request: As there are multiple data structures available to solve a particular problem, this feature allows one to choose the most optimized data structure for a particular problem.
Example of the problem
Array vs Stack
References/Other comments
The example given here is very generic and basic, there can be multiple metrics to compare data structures.
The text was updated successfully, but these errors were encountered: