Dynamic Array Code

  Рет қаралды 66,143

WilliamFiset

WilliamFiset

Күн бұрын

Пікірлер: 43
@iqbalibrahim4713
@iqbalibrahim4713 6 жыл бұрын
thank goodness all your examples are in java, because there are so many videos show algo in c++, and luckily I found you, thank god your a life saviour
@shankar7435
@shankar7435 4 ай бұрын
Thinking the same here..😂😂😂
@kaushik1001
@kaushik1001 8 күн бұрын
Content is absolute gem.
@Alex-de7rz
@Alex-de7rz 2 жыл бұрын
This channel is a hidden gem.
@AbhishekZambre
@AbhishekZambre 4 жыл бұрын
I think the check at line 48 should have OR condition rather than AND. if(rm_index >= len || rm_index < 0) throw new IndexOutOfBoundsException();
@karuneshpal8908
@karuneshpal8908 3 жыл бұрын
u r right Abhishek
@sandeepharidasula3191
@sandeepharidasula3191 5 жыл бұрын
Thank you so much for sharing your knowledge.
@Colstonewall
@Colstonewall 8 жыл бұрын
Thanks, William!
@superoxidedismutase5757
@superoxidedismutase5757 5 жыл бұрын
your voice is so relaxing
@rahulgawale
@rahulgawale 3 жыл бұрын
Thank you very much for the detailed video.
@CoolCoder_
@CoolCoder_ 2 жыл бұрын
Good job on the implementation but I would love to see better code comments! :D
@JayPatel12928
@JayPatel12928 3 жыл бұрын
In clear(), why do we loop through the array and explicitly set each element to null? Can't we just reassign `arr` to a brand new list? assuming the detached old array would be garbage collected automatically? I want to understand the reasoning behind this decision.
@yahyafati
@yahyafati 4 жыл бұрын
Thanks for this great course. It is an amazing course, and I have learnt a lot so far. I have done an hour of the course so far and I have a question. In the implementation of the Dynamic Array why is the capacity of the array changed after removal of an element. I get that it's size(len) changes, but why is the capacity reset aswell?
@jakenguyen2584
@jakenguyen2584 2 жыл бұрын
I was wondering the same thing about setting the capacity to len--. I think it should be len-- instead of capacity = len--;
@rusticExploration
@rusticExploration 4 жыл бұрын
removeAt might give undesired result , if index is equal to 0 and previously length was one, at line 50
@I_dont_want_an_id
@I_dont_want_an_id 4 жыл бұрын
May this encourage your faith facebook.com/esther.chester77/videos/1029971633787995/ kzbin.info/www/bejne/o3rbfJ9vgL6qhLc m.facebook.com/story.php?story_fbid=2582272895211292&id=490097534428849 m.kzbin.info/www/bejne/e3aVpH1jjK6ZqtU kzbin.info/www/bejne/h6iVmaqZpMiJrK8 m.facebook.com/story.php?story_fbid=777934336005747&id=100013675634259
@bharpursingh
@bharpursingh 3 жыл бұрын
2.11 What is the meaning of balanced check, that he is not doing?
@amanbhatia7442
@amanbhatia7442 5 жыл бұрын
Hi William, I dont understand why have you set capacity to len - 1 in removeAt. Couldnt we just do away with decrementing length?
@jovanpetrovic168
@jovanpetrovic168 4 жыл бұрын
I agree with you
@MrManUnited1231
@MrManUnited1231 4 жыл бұрын
Shouldn't the operator on line 48 be a logical or "||" instead of logical and?
@blairbass84
@blairbass84 2 жыл бұрын
I caught this as well. Definitely || instead of &&
@arhamshafiqexplains
@arhamshafiqexplains 6 ай бұрын
Why have you used Object instead of Generics T as arguments in the remove(), indexOf(), and contains() methods?
@saschion
@saschion 3 жыл бұрын
how would i create a array like this and how i use the methods?
@brayaon
@brayaon 6 жыл бұрын
what editor is that?? Thank you for share your knowledge
@WilliamFiset-videos
@WilliamFiset-videos 6 жыл бұрын
sublime text
@mjaesthetics9300
@mjaesthetics9300 7 ай бұрын
this looks like implementation of ArrayList in java. Is that right?
@ppchavan001
@ppchavan001 4 жыл бұрын
4:50 is'nt that code going crash if you remove indexAt 0?
@buihung3704
@buihung3704 Жыл бұрын
Also, why T arr = (T[]) new Object[capacity] ? Why don't u write T arr = new T[capacity]?
@alexanderten5497
@alexanderten5497 5 жыл бұрын
i did not understand anything here
@Debianguy31
@Debianguy31 10 ай бұрын
There are many prerequisites like OOps,Generics, functions 😅
@shankar7435
@shankar7435 4 ай бұрын
​@@Debianguy31I would have been in his position had I not been fairly proficient in Java Generics. Now at least I do not get stuck reading that code. I understand every bit of the code but difficult to reproduce with the same ease when its required due to too many conditions to consider.
@scottzeta3067
@scottzeta3067 2 жыл бұрын
removeAt is not correct, line 52 should be i++ instead of j--
@劉宗旻-k9l
@劉宗旻-k9l 2 жыл бұрын
Thank you! I was confusing for a long time until I saw your comment.
@buihung3704
@buihung3704 Жыл бұрын
You're wrong. If i++, you will be skipping an element which is rm_index + 1 right in that iteration, making new_arr lost that value, looks closely it's an if-else, not if + a line that always run on each iteration :v
@indranishome9003
@indranishome9003 3 жыл бұрын
What ide is this ?
@buihung3704
@buihung3704 Жыл бұрын
Wtf is wrong with this code? In removeAt(), you didn't consider the AND condition on line 48? How about rm_index = 0 and len = 1, how are u gonna initialize a static array with 0 space on line 50? P.s: Okay i understand the capacity reset, since this is a new array not the old array anymore, the new array have been placed on different memory pointer than the old one. Old capacity don't mean shjt after changing array. So why don't we make the capacity x2 the length after call removeAt()? Well this is what I called uncertainty, u don't know what u gonna do next right? Wait until u call add() method again and then u can allocate more capacity. P.s 2: I study the continuous mechanism of array in memory context :3
@patricksile
@patricksile 7 жыл бұрын
Everything was nice till I saw your examples were in `Java`. :smile:
@ayeshabashir5785
@ayeshabashir5785 6 жыл бұрын
same!
@alaetouba9049
@alaetouba9049 4 жыл бұрын
haha whats wrong with java?
@alizafari8729
@alizafari8729 4 жыл бұрын
Python and C++ implementations could be found here: github.com/akzare/Algorithms
@SantoshKumar-lz2ti
@SantoshKumar-lz2ti 2 жыл бұрын
why java??? why not c++🥲
@mikaeltofvesson1882
@mikaeltofvesson1882 7 жыл бұрын
public T remove(int idx){ T removeItem = theItems[idx]; for(int i = idx; i < size()-1; i++ ){ theItems[i] = theItems[i+1]; } theSize--; return removeItem; }
Linked Lists Introduction
14:43
WilliamFiset
Рет қаралды 64 М.
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 570 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 700 М.
It’s all not real
00:15
V.A. show / Магика
Рет қаралды 20 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Dynamic Arrays 🌱
24:22
Bro Code
Рет қаралды 104 М.
Dynamic and Static Arrays
11:52
WilliamFiset
Рет қаралды 96 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 905 М.
Abstraction Can Make Your Code Worse
5:13
CodeAesthetic
Рет қаралды 679 М.
Design a Dynamic Array (Resizable Array)
11:17
NeetCodeIO
Рет қаралды 44 М.
Doubly Linked List Code
9:36
WilliamFiset
Рет қаралды 47 М.
All Rust features explained
21:30
Let's Get Rusty
Рет қаралды 331 М.
The Absolute Best Intro to Monads For Software Engineers
15:12
Studying With Alex
Рет қаралды 677 М.
Abstract data types
4:48
WilliamFiset
Рет қаралды 141 М.
How to Resize an Array in C/C++? Is there a best way?
12:16
Jacob Sorber
Рет қаралды 24 М.