Space Complexity of Algorithms - How to Calculate Space Complexity of Algorithms in Data Structures

  Рет қаралды 113,551

Simple Snippets

4 жыл бұрын

Support Simple Snippets by Donations -
Google Pay UPI ID - tanmaysakpal11@okicici
PayPal - paypal.me/tanmaysakpal11
--------------------------------------------------------------------------------------------- Understand the concept of Space complexity of algorithms and how to calculate space complexity.
Definition: The space complexity of an algorithm or a computer program is the amount of memory space required to solve an instance of the computational problem as a function of the size of the input.
Simple words : It is the memory required by an algorithm to execute a program and produce output.
Similar to time complexity, Space complexity is often expressed asymptotically in big O notation, such as O(n), O(nlog(n)), O(n^2) etc., where n is the input size in units of bits needed to represent the input.
For any algorithm, memory is required for the following purposes -
1) To store program instructions.
2) To store constant values.
3) To store variable values.
4) And for few other things like function calls, jumping statements etc.
Auxiliary Space : is the temporary space (excluding the input size) allocated by your algorithm to solve the problem, with respect to input size.
Space complexity includes both Auxiliary space and space used by input.
Space Complexity = Input Size + Auxiliary space.
Full DSA playlist - kzfaq.info/get/bejne/jqmpqKuEr7mbiHk.html
C++ Programming Tutorials for Beginners Course - kzfaq.info/get/bejne/d7F-espyvbrFop8.html
Simple Snippets Official Website -
simplesnippets.tech/
Simple Snippets on Facebook -
simplesnippets/
Simple Snippets on Instagram -
simplesnippets
Simple Snippets on Twitter -
simplesnippet
Simple Snippets Google Plus Page -
plus.google.com/+SimpleSnippets
Simple Snippets email ID -
simplesnippetsinfo@gmail.com
For More Technology News, Latest Updates and Blog articles visit our Official Website - simplesnippets.tech/
#bigonotation #algorithmanalysis #spacecomplexity #bigO

Пікірлер: 168
@almightyblazettv8421
@almightyblazettv8421 Жыл бұрын
bro saved me in data structures and now im studying for interviews. This man has all the answers and best tutorials to learn from. THANK YOU.
@abhishekkumaryadav652
@abhishekkumaryadav652 3 жыл бұрын
This is one of the best video on space complexity, I got what I had come to see,thanks
@DavidBadilloMusic
@DavidBadilloMusic 2 жыл бұрын
Very clear explanation! I didn't even feel the 28 minutes in length! Thank you!
@Sebas197HF
@Sebas197HF 4 жыл бұрын
I rarely comment in videos or in other types of contents in general, but this video was worth every single second! I've seen explanatory videos on topics of this kind and I can assure that you are one of the best at explaining! I was able to understand thoroughly thanks to your very detailed examples and theory behind them, they were easy to follow and tackled the point effectively. I hope to see way more content from you! Thank you!!!
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you so much buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@rengadevivigneshwaran3005
@rengadevivigneshwaran3005 2 жыл бұрын
yes absolutely yes
@avinashvishwakarma6488
@avinashvishwakarma6488 2 жыл бұрын
yes bro
@veatrtwin8870
@veatrtwin8870 2 жыл бұрын
@@SimpleSnippets Already shared bro
@dipaliborade7864
@dipaliborade7864 3 жыл бұрын
Really this is the best explanation that I have ever seen till now........thank you so much for this video
@zafershah247
@zafershah247 3 жыл бұрын
Can't even deny this is the best playlist on DSA in YT.🙏🙏 You are a legend man, kindly finish the whole playlist of DSA.
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thank you, I will!
@manishchitre5130
@manishchitre5130 2 жыл бұрын
Seen countless videos on the topic but never understood the topic in depth.. Thanks a lot for clarifying things
@user-kg6jq9vc2v
@user-kg6jq9vc2v 14 күн бұрын
Wow..This is the best explaination on Space Complexity so far.
@elimuraya9044
@elimuraya9044 3 жыл бұрын
Simple.Precise.Understandable. Awesome explanation @Simple Snippets
@ihsaashi11
@ihsaashi11 Жыл бұрын
Very well orated ... Clears all the basic doubts and answers as to all the whys and whens
@fatimameryam6215
@fatimameryam6215 3 жыл бұрын
Thank you so much for this video ! My professor really glossed over this concept quickly so I truly appreciate the time you spent explaining it ! :) very helpful
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Glad it was helpful! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@saladisatyanarayana7166
@saladisatyanarayana7166 3 жыл бұрын
thank you, Simple Snippets I found what I need ... It's really helpful
@jmous8094
@jmous8094 2 жыл бұрын
Simple, clear explanations. Thank you!
@jayantkeer3416
@jayantkeer3416 Жыл бұрын
Thanks bro best video for space complexity
@mjprayog
@mjprayog 3 жыл бұрын
Thank You Very Much Bro!! Completed my Internals syllabus in just 3 days. You are doing a great Job. Keep it up and Best of Luck for future Endeavours.
@mjprayog
@mjprayog 3 жыл бұрын
What I found missing from my syllabus is Sparse Matrices and Comparison of Sorting Techniques via Empirical Techniques.
@anikevin
@anikevin 2 жыл бұрын
Thank you. Most people focus on time complexity only. I'm glad I found this video.
@aditidhumal4566
@aditidhumal4566 3 жыл бұрын
Thanks for alll the videos, hope we would have teachers like you in the colleges.
@kbarot3886
@kbarot3886 2 жыл бұрын
Great video, thank you🙌
@xdeep613
@xdeep613 Жыл бұрын
Best video on sapce complexity thank you so much
@itsok391
@itsok391 2 жыл бұрын
Thank you so much! This really helps me to understand well about space complexity.
@rytales4480
@rytales4480 2 жыл бұрын
I hardly comment on youtube video but this is such clean explanation on space complexity best explanation on space complexity so far.
@arnavshil1404
@arnavshil1404 Жыл бұрын
Thanks. Very detailed and informative video. Please keep this up. The place for a teacher in society is at the top, because of teachers like you, we can rest assured for unskilled and job.
@kishorekotyada6538
@kishorekotyada6538 Жыл бұрын
Amazing explanation as usual. Thanks for your effort.
@muzammilkhan382
@muzammilkhan382 Жыл бұрын
Thankyou brother you made me understand easily ❤
@vishalsinghdhamiak47
@vishalsinghdhamiak47 2 жыл бұрын
Bhai etni maehnat sirf space complexity smjhane kae liye bhai etne efforts thanks bhai
@loke9271
@loke9271 Жыл бұрын
simple excellent explanation.
@rajaravikirans5307
@rajaravikirans5307 Жыл бұрын
Great Video bro. You provided Clear explanation with examples.
@rohitkamble8515
@rohitkamble8515 2 жыл бұрын
Thank you so much Tanmay.
@maedehshahabi4744
@maedehshahabi4744 2 жыл бұрын
Thank you very much, the explanation was so great
@bhanugoyal428
@bhanugoyal428 2 жыл бұрын
Excellent Explanation
@nakuldatla
@nakuldatla 2 жыл бұрын
Really appreciate the video!
@chetana8368
@chetana8368 3 жыл бұрын
these are such important concepts still its very dificult too find one good explanation video in yt. this video is sooo much amaizing
@es696
@es696 2 жыл бұрын
Beautiful tutorial. Thanks mate
@scorpioramu
@scorpioramu 3 жыл бұрын
Thanks a lot for nice video.
@uzochukwu1556
@uzochukwu1556 6 ай бұрын
Awesome Video
@kaykim4531
@kaykim4531 Жыл бұрын
Thank you so much!
@luckymoon2488
@luckymoon2488 Жыл бұрын
this video deserve millions of views
@sidhartheleswarapu
@sidhartheleswarapu 4 жыл бұрын
The auxiliary space isn't always dependent on just the call stack size, right? For instance, we may allocate memory within the function.
@mindcoder4823
@mindcoder4823 4 жыл бұрын
I'm glad that i am the 10th person to like this tutorial. I was here a couple of days looking for this but could not find it. Thank you so much, you've got to be the best out here.
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Most welcome buddy 😇 very glad to hear this from you. I'm gonna put many more topics in this DSA playlist one by one ✌️
@hughluo8494
@hughluo8494 2 жыл бұрын
It is very helpful, thanks :)
@yuco64
@yuco64 4 жыл бұрын
bro this really help me, thanks from México
@shafiqulabidin1487
@shafiqulabidin1487 2 жыл бұрын
very informative video. contents are clear and understandable.
@mrAnbu005
@mrAnbu005 2 жыл бұрын
Just now saw the video and subscribed the channel
@vivekhattarge5795
@vivekhattarge5795 4 жыл бұрын
Really awesome video.... Got cleared this concept very well... Thanks a lot
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thanks Vivek, I am glad you understood this topic. Time & Space complexity are very important topics in DSA Subject 😇
@RitikSharma-pc5yj
@RitikSharma-pc5yj 4 жыл бұрын
I was searching for appropriate explanation on space complexities..Thank God. you made my day :')
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Glad I could help! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@towritelove6850
@towritelove6850 2 жыл бұрын
Space complexity very well explained !
@kundanKumar-cc7qt
@kundanKumar-cc7qt 3 жыл бұрын
Clear explanation
@ramiroherrera7681
@ramiroherrera7681 3 жыл бұрын
Thanks a lot for the video !!
@moonlight-td8ed
@moonlight-td8ed 2 жыл бұрын
i dont think anyone could explain space complexity as clear as you have explained
@yogiermanto1874
@yogiermanto1874 Жыл бұрын
thank you, the best & clear explanation of space complexity
@SimpleSnippets
@SimpleSnippets Жыл бұрын
Glad it helped!
@ghizlenemedelci7568
@ghizlenemedelci7568 Жыл бұрын
You are a life saver! Please make more videos, we need you! :))
@nelsonberm3910
@nelsonberm3910 Ай бұрын
Great video
@jisavarghese6003
@jisavarghese6003 3 жыл бұрын
Very clear explanation 👌👏
@donottrackmepls
@donottrackmepls Жыл бұрын
perfect explanation
@haricharanvalleru4411
@haricharanvalleru4411 2 жыл бұрын
helpful a lot as explanation is really good
@dhonddevameya2362
@dhonddevameya2362 3 жыл бұрын
Touched every corner in the concept. Nice explanation👍
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Glad you liked it.
@sriramvadakattu6635
@sriramvadakattu6635 3 жыл бұрын
Thank you. simple and easy to follow
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thanks buddy, means a lot. Please do share the channel with your friends & ask them to join our Subscriber family too😊 that will be the biggest help & support 🤟
@user-in2vg7ec1n
@user-in2vg7ec1n 2 жыл бұрын
great video!
@hroman_codes
@hroman_codes 3 жыл бұрын
This was the best explanation of space complexity I have seen so far thank you! 🙏 great examples.
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Glad it was helpful!
@rengadevivigneshwaran3005
@rengadevivigneshwaran3005 2 жыл бұрын
really yes
@chethanvenkataramaiah6940
@chethanvenkataramaiah6940 Жыл бұрын
Really appreciate for explaining so nicely and for putting a ton of effort in the video editing part as well. It was worth watching the video
@SimpleSnippets
@SimpleSnippets Жыл бұрын
Thank you so much Chethan 🙏😊
@sumanthkarmarkar1760
@sumanthkarmarkar1760 Жыл бұрын
at 12:18, how is it O(N)? we are not declaring any new variable in each iteration. We just access the existing array. So how is it going to take O(N)? just modifying the existing variables or array elements take O(1). isn't it?
@yomamasofat413
@yomamasofat413 3 ай бұрын
very good video didnt know it's better to use a loop rather than a recursion for factorial
@brandonlind5700
@brandonlind5700 Жыл бұрын
great video
@nelsonberm3910
@nelsonberm3910 Ай бұрын
You can consider adding how a list creation inside a function adds space complexity, that's why I came to this video, but I do understand it!
@roshnimandarapu5097
@roshnimandarapu5097 2 жыл бұрын
amazing!!
@vd.se.17
@vd.se.17 4 жыл бұрын
Its good explaination beside 4 th algorithm, I think at 24:00 the memory must be 24, and it suits to 4 + 4n = a linear approach. Please guide me if I am wrong. Well, thank you for interactive turorial.
@cm-037hemanth8
@cm-037hemanth8 Жыл бұрын
Thanks
@m.y.m401
@m.y.m401 Жыл бұрын
thank you
@snehendubiswas1032
@snehendubiswas1032 3 жыл бұрын
Till now the best explanation regarding this topic🔥
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thank you so much bro 🤘 I'm glad you liked this ☺️
@sruthibuddepu2090
@sruthibuddepu2090 3 жыл бұрын
can u pls tell me how the auxillary space value is 4???
@abhisheksinha3119
@abhisheksinha3119 3 жыл бұрын
If we look at the space complexity of Algorithm 2 then it is O(n). Fine. But suppose I want to find the auxiliary space then it will be O(1) right? Please reply.
@_just_for_fun_4472
@_just_for_fun_4472 3 жыл бұрын
plz add the time stamps also...it will be really helpful for us...
@ramiroherrera7681
@ramiroherrera7681 3 жыл бұрын
Could you please add some examples with Strings, Objects, HashMaps, List, Arrays, etc
@_tanujpokhriyal
@_tanujpokhriyal 2 жыл бұрын
Bhaiya thanks a lot !
@gouthamrajkr46
@gouthamrajkr46 4 жыл бұрын
sir for loop it take i*N??
@tineitinkymagaso2081
@tineitinkymagaso2081 3 жыл бұрын
Best explanation on space complexity i found here
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thank you so much 🙂 Please do share the videos and channel with your friends as well. Thats the biggest help and support you can provide to me so that I can keep making such tech educational videos for everyone!
@ViniciuxMariano
@ViniciuxMariano 7 ай бұрын
Very good Explanation!
@SimpleSnippets
@SimpleSnippets 7 ай бұрын
Glad it was helpful!
@omarz5009
@omarz5009 4 жыл бұрын
Thank you for the great tutorial :) may I ask what art tool do you use for drawing ?
@adityapangtey3501
@adityapangtey3501 2 жыл бұрын
its time to move on;-)
@daniyalmasood4649
@daniyalmasood4649 4 жыл бұрын
I was waiting for this video on your playlist from a long time but now I have got this video thanks bro your videos and the method of explanation is quite good God bless you☺️☺️☺️☺️☺️👍👍👍👍
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Most welcome buddy ✌️ I'm glad to hear this. Many more topics will be coming up in DSA course. It's just that these topics take a lot of time and effort cause the topics are tricky to teach especially when you have to make it easy 😬 I would highly appreciate if you can please share the videos with your friends bro, that's the biggest help and support 😇
@daniyalmasood4649
@daniyalmasood4649 4 жыл бұрын
@@SimpleSnippets I often share your videos with my friend and than my friends also send your videos to their friends so the cycle is running till now and also will run in the future videos☺️☺️
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you buddy, this means a lot 😇
@solok4150
@solok4150 2 жыл бұрын
Nice 👍
@GeetaMunjalMCA
@GeetaMunjalMCA 4 жыл бұрын
hii, i have a query related to this ,that when u were telling recursive approach....during that time ,input size also be 4bytes*nbecause each time memory will create new for n?please reply?
@mouleshmanikandan1392
@mouleshmanikandan1392 4 жыл бұрын
@Simple Snippets yes even im having the same doubt bro..
@geekaffairs6475
@geekaffairs6475 2 жыл бұрын
What if I create a temporary int variable in for loop, it will get created n times.. and will get garbage collected on every GC cycle in some time.. so we cannot say that it will take just 4 bytes right, and neither can we say that it is going to take N * 4 bytes because some of will get garbage collected. So it should be some random number * 4 bytes because after that a GC will clear it up.
@hollyj8650
@hollyj8650 2 жыл бұрын
Damn! Right now I’m taking algorithms class. And this is soooo good to understand and help me to do assignments about algorithms analysis as well as will help me to interview. When I read elsewhere it’s not clear.
@saipavankumark985
@saipavankumark985 4 жыл бұрын
Really helpful east or west simple snippets is the best
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Hehe definitely we're the best 😎❤️ Thank you for the compliments 😇
@b.v.vsatyanarayana7410
@b.v.vsatyanarayana7410 3 жыл бұрын
Anna .. how to find auxillary space mathematically ?? You just assume that only how it corrects everywhere??? Plz reply me if anyone can know....
@amalthiru206
@amalthiru206 Жыл бұрын
Amazing video!
@SimpleSnippets
@SimpleSnippets Жыл бұрын
Glad you think so!
@Rahman-bp8jz
@Rahman-bp8jz 2 жыл бұрын
Thank you thanmay doing great 😘😘😘😘😘😘😘😘😘😘😍😍😍😍😍😍😍😍😍😍 .❤️❤️❤️
@karthikgaddam4560
@karthikgaddam4560 3 жыл бұрын
Awesome
@Intellect.Ignite
@Intellect.Ignite 2 жыл бұрын
nice...........
@OlabodeAdedoyin
@OlabodeAdedoyin 4 жыл бұрын
Hey! great video! Thanks
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you so much buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@iqraashraf8837
@iqraashraf8837 4 жыл бұрын
thnkx ....its much helpful👍👍
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Most welcome 😊 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@somnathghosh3207
@somnathghosh3207 2 жыл бұрын
Super ❤️❤️❤️
@avinashvishwakarma6488
@avinashvishwakarma6488 2 жыл бұрын
It would be much helpful bhaiyya if you provide the drive link of these notes in the description. Awesome content on DSA.
@studymaterial5893
@studymaterial5893 3 жыл бұрын
Plz ye video hindi language me bnavo na muje time and space complexity padna he ...apne bhot aachha explain kiya he. Or practice ke liye or algorithm lo
@spatil6884
@spatil6884 4 жыл бұрын
Really great video you deserve to be great teacher please upload more tutorial on data structures which will help all of us to study We understand it easily
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you so much brother 😇 it's means a lot. I just have one request Shubham, please share our channel and videos with your friends & definitely Subscribe 😇
@spatil6884
@spatil6884 4 жыл бұрын
@@SimpleSnippets definitely sir you deserve it because you explain all the concept that anyone can understand
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
@@spatil6884 thank you brother 😇 I try my best to make it as simple as possible 🤘
@rahulbarate3954
@rahulbarate3954 3 жыл бұрын
Thank You Brother 👍🏻👌🏻
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Welcome 👍
@user-vr1od8gk5d
@user-vr1od8gk5d 3 ай бұрын
there is no memory allocation for arr in "algorithm 2" so that part of code will have O(1) space
@hgiangphan
@hgiangphan 3 жыл бұрын
Thank you!
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
You're welcome!
@sathwikshetty917
@sathwikshetty917 3 жыл бұрын
Very much thanks for this playlist bro..I'm ece student I want to get in to software side for which ds and algo is pretty much important...so I'm learning from u..thanks for this playlist ❤️😁
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Glad you liked it! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@sathwikshetty917
@sathwikshetty917 3 жыл бұрын
@@SimpleSnippets can u please also make videos on graphs concept too
@hippohugz9966
@hippohugz9966 2 жыл бұрын
isnt algorithm 3 o(n)? not o(1)?
Пробую самое сладкое вещество во Вселенной
00:41
Incredible magic 🤯✨
00:53
America's Got Talent
Рет қаралды 21 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,6 МЛН
Пробую самое сладкое вещество во Вселенной
00:41