You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added optimized bubble sort, thought it might be relevant
Added json file reading, used frequently in NoSQL questions where contents of a json file is uploaded to a MongoDB database.
I will leave the pull request as it is instead of making it a permanent commit, as the content may be beneficial to some.
The optimized bubble sort can be faster than the original version empirically, but we all know that it will never beat the allegations for O(n^2) average time complexity. As for file operations, while it is true that the context manager helps with the closing of files ever since a certain Python version, I included f.close() anyways for better code readability and it's probably better to include that statement especially during examinations. The json file reading is a good add, though I would appreciate if you could pretty print the output.
I will leave the pull request as it is instead of making it a permanent commit, as the content may be beneficial to some.
The optimized bubble sort can be faster than the original version empirically, but we all know that it will never beat the allegations for O(n^2) average time complexity. As for file operations, while it is true that the context manager helps with the closing of files ever since a certain Python version, I included f.close() anyways for better code readability and it's probably better to include that statement especially during examinations. The json file reading is a good add, though I would appreciate if you could pretty print the output.
I just did a small check on my repo, and found that 10 NoSQL.py already contains code on how to read json files. Your code on pretty print will be helpful though.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added optimized bubble sort, thought it might be relevant
Added json file reading, used frequently in NoSQL questions where contents of a json file is uploaded to a MongoDB database.