-
-
Notifications
You must be signed in to change notification settings - Fork 132
Add Some Array Manipulation in CPP #23
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
Conversation
✅ Deploy Preview for quicksnip ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Hey, there! Thanks for the contribution. 🙌 |
@saminjay and @Mathys-Gasnier, what do you think about these snippets? |
@dostonnabotov, But the changes aren't showing on the site. What's the issue? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those are in the cpp examples but dont really use that much cpp features over c ones.
Please changes things like function taking c array to cpp vectors and such.
"#include <climits>", | ||
"", | ||
"", | ||
"void findCommonElements(const int arr1[], int size1, int arr2[], int size2, int& commonCount) {", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a fan of this function too,
It doesn't return the common elements but the number of common elements.
It also modifies one the array which can be non desired behavior...
Most of these functions are just common DSA solutions. They aren't exactly "handy" because you rarely use them. I don't know if this is wanted, @dostonnabotov can clear that up. |
"author": "shovan04" | ||
}, | ||
{ | ||
"title": "Find Second Largest Element in an Array", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this function, can you make a generalised function that returns Largest k
elements?
Also I think for a snippet function it is always better to return the result rather than modifying the passed variables. |
Before requesting another review please review what was said to you, and changes things that were asked. |
Hey, we recently updated how snippets are stored, please update your PR to match the changes, you will be able to see how to add snippets in |
Hey, changes were requested on your PR, but we got no news for more than a week, Closing this as stale. |
Find Minimum and Maximum Values in an Array: Efficiently identifies the smallest and largest values in a given array using a single traversal.
Find Second Largest Element in an Array: Determines the second-largest element with minimal overhead using only a single loop.
Sort Array in Descending Order: Implements the Bubble Sort algorithm to sort an array in descending order.
Find Common Elements in Two Arrays: Identifies common elements between two arrays without requiring additional data structures, using marking for tracking matches.