-
-
Notifications
You must be signed in to change notification settings - Fork 766
Added one more Data Structure - Arrays #111
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
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.
👍 Good work!
Co-authored-by: David Leal <[email protected]>
Co-authored-by: David Leal <[email protected]>
Co-authored-by: David Leal <[email protected]>
Co-authored-by: David Leal <[email protected]>
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.
LGTM. Thank you for your contribution! 👍 🎉
@appgurueu, would you like to review this PR? Thanks. 🙂
Oddly programming language (C) specific. I'd want something more abstract: Arrays are used to represent ordered sets of elements in memory accessible through indices in O(1) constant time (usually through pointer arithmetics, as you noted, but that's implementation specific). Array size is fixed, other than, say, linked list size. |
Ohh then we can use vectors instead more specifically vector arrays. I mean there will not be size restriction and accessing elements using index will still be there. Moreover arrays (normal and vector both) are very commonly used by everyone. Let me know your thoughts |
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.
Some suggestions to make the concept of arrays more clear and to make them more general, i.e., not oriented to a single language.
Co-authored-by: Rak Laptudirm <[email protected]>
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.
Almost there! 😄
Co-authored-by: David Leal <[email protected]>
Co-authored-by: David Leal <[email protected]>
Co-authored-by: David Leal <[email protected]>
0f2a9ce
Alright. Using stack is anyways very bad. |
Co-authored-by: David Leal <[email protected]>
@appgurueu, would you like to review? Thanks. |
No it's not? A linked stack has constant time pushing and popping. Still, the compile time remark depends on your terminology. In Golang terms, this is correct; arrays whose size is known at runtime are called slices. Array size is fixed at allocation. |
I think we shouldn't take different languages as examples since every data structure is not same in every language in terms of declaration or working. We are creating this array file assuming that the person seeing will use it where it can be applied in the way. |
This isn't about languages, it is about terminology. Usually, the term "array" is not used to only refer to arrays whose size is fixed at compile time. That's a Golang thing. Array size is fixed at allocation. In C for example you can do |
|
See https://stackoverflow.com/questions/2672085/static-array-vs-dynamic-array-in-c. You're calling only static arrays arrays, but dynamic arrays are arrays too. It is important to include this distinction. |
You're calling only static arrays arrays, but dynamic arrays are arrays too. It is important to include this distinction. Correct. Review it once. |
In the Data Structure folder I have added the brief explanation of arrays.