Dynamic and Static Arrays

  Рет қаралды 101,236

WilliamFiset

WilliamFiset

Күн бұрын

Пікірлер: 26
@PaAGadirajuSanjayVarma
@PaAGadirajuSanjayVarma 3 жыл бұрын
Thank you williamFiset for taking your time for us.
@skaruts
@skaruts 4 жыл бұрын
Everybody always says 0 indexing confuses newbies, but I've never seen anyone confused about it. I'm not a teacher, but I've been a beginner and read many beginner questions/answers in forums. Personally I never had one bit of trouble with it...
@NaveenKumar-qf8nn
@NaveenKumar-qf8nn 4 жыл бұрын
Bro even I am a beginner but I don't know how to utilize my time can u help me out
@skaruts
@skaruts 9 ай бұрын
@@2097bugs I don't see how that's confusing, but if you're coding in a language with C-like loops, then you're gonna have to be mindful of that either way. In fact, you still have to be mindful of that in 1-indexed languages. And if you think that's confusing for beginners, then let me tell you that 1-indexing brings a whole lot more confusion than just that. One of the problems I faced in my first months of Lua, was trying to understand when to 1-index and when not to, and even after 5 years sometimes I'm still not sure. And I was a beginner in Lua, but not in programming. It's an unnecessary confusion and waste of time. This is because many arrays *have to be* indexed from 0, because indexing math only works with 0 indexing. As a result, if the language is 1-indexed, then you'll have inconsistent code, where some arrays are 1-indexed and some are 0-indexed, which makes it more error prone and potentially confusing to write code that handles both. You can have all arrays 0-indexed, but not all arrays 1-indexed. And in a 1-indexed language like Lua, any time you use a 0-based loop you have to put *_-1_* on the limit, which is error prone and it's equivalent to having to use
@kevincarr2334
@kevincarr2334 5 жыл бұрын
William you're a beast! Thank you for sharing your knowledge
@pb25193
@pb25193 4 жыл бұрын
William Beaset
@mummafier
@mummafier Жыл бұрын
I think i read somewhere that deleting art the end of an array is O(1) while deleting anywhere else is linear. Trivial but definitely good to know.
@madiwork-b4l
@madiwork-b4l Ай бұрын
Correct. Deleting the last index in an array takes constant time; O(1). Deleting from anywhere else (middle/start... etc.) requires iterating over the other/affected elements to shift their location in the array, which takes O(n) time in the worst case.
@mody5370
@mody5370 2 жыл бұрын
ما شاء الله You're awesome bro
@musthafajm
@musthafajm 6 жыл бұрын
Very good presentation sir. Very easy to understand.
@jasonchen4492
@jasonchen4492 Ай бұрын
awesome work thank you so much
@neonmason1
@neonmason1 4 жыл бұрын
Hi William, to make dynamic arrays, you mentioned that there's more than one way to do so. Can I know the general idea of the other methods? I searched the web and could not find any leads to them.
@WilliamFiset-videos
@WilliamFiset-videos 4 жыл бұрын
You can implement with a linked list as the underlying storage
@neonmason1
@neonmason1 4 жыл бұрын
@@WilliamFiset-videos I see! Thank you so much :D Hope you have a good day.
@mvdAmine
@mvdAmine Жыл бұрын
Oh! u can use the method arraycopy in java
@hhcdghjjgsdrt235
@hhcdghjjgsdrt235 2 жыл бұрын
Appending complexity is O ( n )
@philosopher_sage_07
@philosopher_sage_07 10 ай бұрын
If there is enough memory, then it is O(1). You just take the next contiguous memory chunk and use that for storing the data. If there isn't, then it isn't O(1). But since it mostly the prior case, the complexity is amortized O(1).
@information88info
@information88info 4 жыл бұрын
awesome
@swarnimapandey7297
@swarnimapandey7297 6 жыл бұрын
isn't deletion in static array should be of linear time complexity?
@kroypatcha
@kroypatcha 5 жыл бұрын
Arrays need to maintain index. If we delete 3rd element in 100 element array, we need to shift 4-100 elements one left. That’s why deletion is O(n)
@skaruts
@skaruts 4 жыл бұрын
Afaik, deletion from a static array is O(1), because nothing ever gets shifted. However, the array is static, so the memory of that index remains allocated, and to delete the index you either replace that piece of memory with new content of the same type, or with NULL (or '\0' in C strings).
@abhinayganapavarapu
@abhinayganapavarapu 4 жыл бұрын
AFAIK the static array is static in nature, which means there should be no functions to modify the data structure. Hence Insertion/Appending/Deletion make no sense. The array is filled once and only search and accessing/modifying the values are permitted but the size of the array remains static.
@moazelsawaf2000
@moazelsawaf2000 5 жыл бұрын
Thanks
@baloshi69
@baloshi69 Жыл бұрын
Am i right to say, that in python we don't need to vopy the arry to anew arry to increase its capacity. This will happen automatically we can add as many item as we want. ???
@Nyquiiist
@Nyquiiist 5 ай бұрын
What do you think Python does behind the scenes for you ?
@nischalvooda886
@nischalvooda886 3 ай бұрын
Yes
Dynamic Array Code
6:46
WilliamFiset
Рет қаралды 69 М.
you will never ask about pointers again after watching this video
8:03
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН
So Cute 🥰 who is better?
00:15
dednahype
Рет қаралды 19 МЛН
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
Introduction to Big-O
12:40
WilliamFiset
Рет қаралды 304 М.
Arenas, strings and Scuffed Templates in C
12:28
VoxelRifts
Рет қаралды 105 М.
before you code, learn how computers work
7:05
Low Level
Рет қаралды 624 М.
Mastering Dynamic Programming - How to solve any interview problem (Part 1)
19:41
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 344 М.
How to Start LeetCode from ZERO in 2025
11:31
Ashish Pratap Singh
Рет қаралды 133 М.
Writing Code That Runs FAST on a GPU
15:32
Low Level
Рет қаралды 579 М.
Linked Lists Introduction
14:43
WilliamFiset
Рет қаралды 66 М.
How Strong Is Tape?
00:24
Stokes Twins
Рет қаралды 96 МЛН