Space Complexity of Algorithms - How to Calculate Space Complexity of Algorithms in Data Structures
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 - • Introduction to Data S...
C++ Programming Tutorials for Beginners Course - • Introduction to Comput...
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
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.
This is one of the best video on space complexity, I got what I had come to see,thanks
Very clear explanation! I didn't even feel the 28 minutes in length! Thank you!
Really this is the best explanation that I have ever seen till now........thank you so much for this video
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
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
2 жыл бұрын
yes absolutely yes
@avinashvishwakarma6488
2 жыл бұрын
yes bro
@veatrtwin8870
2 жыл бұрын
@@SimpleSnippets Already shared bro
thank you, Simple Snippets I found what I need ... It's really helpful
Seen countless videos on the topic but never understood the topic in depth.. Thanks a lot for clarifying things
Simple, clear explanations. Thank you!
Very well orated ... Clears all the basic doubts and answers as to all the whys and whens
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
3 жыл бұрын
Thank you, I will!
Wow..This is the best explaination on Space Complexity so far.
Simple.Precise.Understandable. Awesome explanation @Simple Snippets
Thank you so much! This really helps me to understand well about space complexity.
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
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 😇
Thanks bro best video for space complexity
Great video, thank you🙌
Amazing explanation as usual. Thanks for your effort.
Best video on sapce complexity thank you so much
Thank you. Most people focus on time complexity only. I'm glad I found this video.
Thank you so much Tanmay.
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
3 жыл бұрын
What I found missing from my syllabus is Sparse Matrices and Comparison of Sorting Techniques via Empirical Techniques.
Thanks for alll the videos, hope we would have teachers like you in the colleges.
Really appreciate the video!
Thankyou brother you made me understand easily ❤
Beautiful tutorial. Thanks mate
Great Video bro. You provided Clear explanation with examples.
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.
Thank you very much, the explanation was so great
Thanks a lot for nice video.
Excellent Explanation
I hardly comment on youtube video but this is such clean explanation on space complexity best explanation on space complexity so far.
simple excellent explanation.
Thank you so much!
these are such important concepts still its very dificult too find one good explanation video in yt. this video is sooo much amaizing
Awesome Video
It is very helpful, thanks :)
Thanks a lot for the video !!
Bhai etni maehnat sirf space complexity smjhane kae liye bhai etne efforts thanks bhai
thank you, the best & clear explanation of space complexity
@SimpleSnippets
Жыл бұрын
Glad it helped!
this video deserve millions of views
bro this really help me, thanks from México
very informative video. contents are clear and understandable.
Clear explanation
I was searching for appropriate explanation on space complexities..Thank God. you made my day :')
@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 😇
You are a life saver! Please make more videos, we need you! :))
perfect explanation
Really awesome video.... Got cleared this concept very well... Thanks a lot
@SimpleSnippets
4 жыл бұрын
Thanks Vivek, I am glad you understood this topic. Time & Space complexity are very important topics in DSA Subject 😇
Just now saw the video and subscribed the channel
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
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 ✌️
Space complexity very well explained !
amazing!!
very good video didnt know it's better to use a loop rather than a recursion for factorial
Great video
Very clear explanation 👌👏
helpful a lot as explanation is really good
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
Жыл бұрын
Thank you so much Chethan 🙏😊
great video!
great video
Touched every corner in the concept. Nice explanation👍
@SimpleSnippets
3 жыл бұрын
Glad you liked it.
Bhaiya thanks a lot !
The auxiliary space isn't always dependent on just the call stack size, right? For instance, we may allocate memory within the function.
Thank you. simple and easy to follow
@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 🤟
thank you
Very good Explanation!
@SimpleSnippets
7 ай бұрын
Glad it was helpful!
i dont think anyone could explain space complexity as clear as you have explained
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.
Till now the best explanation regarding this topic🔥
@SimpleSnippets
3 жыл бұрын
Thank you so much bro 🤘 I'm glad you liked this ☺️
Thanks
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!
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.
Awesome
This was the best explanation of space complexity I have seen so far thank you! 🙏 great examples.
@SimpleSnippets
3 жыл бұрын
Glad it was helpful!
@rengadevivigneshwaran3005
2 жыл бұрын
really yes
Best explanation on space complexity i found here
@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!
Amazing video!
@SimpleSnippets
Жыл бұрын
Glad you think so!
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?
Nice 👍
Thank you thanmay doing great 😘😘😘😘😘😘😘😘😘😘😍😍😍😍😍😍😍😍😍😍 .❤️❤️❤️
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
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
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
4 жыл бұрын
Thank you buddy, this means a lot 😇
Super ❤️❤️❤️
thnkx ....its much helpful👍👍
@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 😇
nice...........
Hey! great video! Thanks
@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 😇
Really helpful east or west simple snippets is the best
@SimpleSnippets
4 жыл бұрын
Hehe definitely we're the best 😎❤️ Thank you for the compliments 😇
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.
Could you please add some examples with Strings, Objects, HashMaps, List, Arrays, etc
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.
Anna .. how to find auxillary space mathematically ?? You just assume that only how it corrects everywhere??? Plz reply me if anyone can know....
you are just too good
@SimpleSnippets
2 жыл бұрын
Thanks Soumya 😊👍 please do share the videos and channel with your friends too 🤟
Thank You Brother 👍🏻👌🏻
@SimpleSnippets
3 жыл бұрын
Welcome 👍
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
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
3 жыл бұрын
@@SimpleSnippets can u please also make videos on graphs concept too
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
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
4 жыл бұрын
@@SimpleSnippets definitely sir you deserve it because you explain all the concept that anyone can understand
@SimpleSnippets
4 жыл бұрын
@@spatil6884 thank you brother 😇 I try my best to make it as simple as possible 🤘
can u pls tell me how the auxillary space value is 4???
sir for loop it take i*N??
It would be much helpful bhaiyya if you provide the drive link of these notes in the description. Awesome content on DSA.
Thank you for the great tutorial :) may I ask what art tool do you use for drawing ?
@adityapangtey3501
2 жыл бұрын
its time to move on;-)
plz add the time stamps also...it will be really helpful for us...
Thank you!
@SimpleSnippets
3 жыл бұрын
You're welcome!
liked and shared
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
4 жыл бұрын
@Simple Snippets yes even im having the same doubt bro..
long story in short, space complexity put a high concerns on the auxiliary space compared to the size of the inputs.