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

  • @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
    @abhishekkumaryadav6523 жыл бұрын

    This is one of the best video on space complexity, I got what I had come to see,thanks

  • @DavidBadilloMusic
    @DavidBadilloMusic2 жыл бұрын

    Very clear explanation! I didn't even feel the 28 minutes in length! Thank you!

  • @dipaliborade7864
    @dipaliborade78643 жыл бұрын

    Really this is the best explanation that I have ever seen till now........thank you so much for this video

  • @Sebas197HF
    @Sebas197HF4 жыл бұрын

    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

  • @saladisatyanarayana7166
    @saladisatyanarayana71663 жыл бұрын

    thank you, Simple Snippets I found what I need ... It's really helpful

  • @manishchitre5130
    @manishchitre51302 жыл бұрын

    Seen countless videos on the topic but never understood the topic in depth.. Thanks a lot for clarifying things

  • @jmous8094
    @jmous80942 жыл бұрын

    Simple, clear explanations. Thank you!

  • @ihsaashi11
    @ihsaashi11 Жыл бұрын

    Very well orated ... Clears all the basic doubts and answers as to all the whys and whens

  • @zafershah247
    @zafershah2473 жыл бұрын

    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!

  • @user-kg6jq9vc2v
    @user-kg6jq9vc2v19 күн бұрын

    Wow..This is the best explaination on Space Complexity so far.

  • @elimuraya9044
    @elimuraya90443 жыл бұрын

    Simple.Precise.Understandable. Awesome explanation @Simple Snippets

  • @itsok391
    @itsok3912 жыл бұрын

    Thank you so much! This really helps me to understand well about space complexity.

  • @fatimameryam6215
    @fatimameryam62153 жыл бұрын

    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 😇

  • @jayantkeer3416
    @jayantkeer3416 Жыл бұрын

    Thanks bro best video for space complexity

  • @kbarot3886
    @kbarot38862 жыл бұрын

    Great video, thank you🙌

  • @kishorekotyada6538
    @kishorekotyada6538 Жыл бұрын

    Amazing explanation as usual. Thanks for your effort.

  • @xdeep613
    @xdeep613 Жыл бұрын

    Best video on sapce complexity thank you so much

  • @anikevin
    @anikevin2 жыл бұрын

    Thank you. Most people focus on time complexity only. I'm glad I found this video.

  • @rohitkamble8515
    @rohitkamble85152 жыл бұрын

    Thank you so much Tanmay.

  • @mjprayog
    @mjprayog3 жыл бұрын

    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.

  • @aditidhumal4566
    @aditidhumal45663 жыл бұрын

    Thanks for alll the videos, hope we would have teachers like you in the colleges.

  • @nakuldatla
    @nakuldatla2 жыл бұрын

    Really appreciate the video!

  • @muzammilkhan382
    @muzammilkhan382 Жыл бұрын

    Thankyou brother you made me understand easily ❤

  • @es696
    @es6962 жыл бұрын

    Beautiful tutorial. Thanks mate

  • @rajaravikirans5307
    @rajaravikirans5307 Жыл бұрын

    Great Video bro. You provided Clear explanation with examples.

  • @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.

  • @maedehshahabi4744
    @maedehshahabi47442 жыл бұрын

    Thank you very much, the explanation was so great

  • @scorpioramu
    @scorpioramu3 жыл бұрын

    Thanks a lot for nice video.

  • @bhanugoyal428
    @bhanugoyal4282 жыл бұрын

    Excellent Explanation

  • @rytales4480
    @rytales44802 жыл бұрын

    I hardly comment on youtube video but this is such clean explanation on space complexity best explanation on space complexity so far.

  • @loke9271
    @loke9271 Жыл бұрын

    simple excellent explanation.

  • @kaykim4531
    @kaykim4531 Жыл бұрын

    Thank you so much!

  • @chetana8368
    @chetana83683 жыл бұрын

    these are such important concepts still its very dificult too find one good explanation video in yt. this video is sooo much amaizing

  • @uzochukwu1556
    @uzochukwu15566 ай бұрын

    Awesome Video

  • @hughluo8494
    @hughluo84942 жыл бұрын

    It is very helpful, thanks :)

  • @ramiroherrera7681
    @ramiroherrera76813 жыл бұрын

    Thanks a lot for the video !!

  • @vishalsinghdhamiak47
    @vishalsinghdhamiak472 жыл бұрын

    Bhai etni maehnat sirf space complexity smjhane kae liye bhai etne efforts thanks bhai

  • @yogiermanto1874
    @yogiermanto1874 Жыл бұрын

    thank you, the best & clear explanation of space complexity

  • @SimpleSnippets

    @SimpleSnippets

    Жыл бұрын

    Glad it helped!

  • @luckymoon2488
    @luckymoon2488 Жыл бұрын

    this video deserve millions of views

  • @yuco64
    @yuco644 жыл бұрын

    bro this really help me, thanks from México

  • @shafiqulabidin1487
    @shafiqulabidin14872 жыл бұрын

    very informative video. contents are clear and understandable.

  • @kundanKumar-cc7qt
    @kundanKumar-cc7qt3 жыл бұрын

    Clear explanation

  • @RitikSharma-pc5yj
    @RitikSharma-pc5yj4 жыл бұрын

    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 😇

  • @ghizlenemedelci7568
    @ghizlenemedelci7568 Жыл бұрын

    You are a life saver! Please make more videos, we need you! :))

  • @donottrackmepls
    @donottrackmepls Жыл бұрын

    perfect explanation

  • @vivekhattarge5795
    @vivekhattarge57954 жыл бұрын

    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 😇

  • @mrAnbu005
    @mrAnbu0052 жыл бұрын

    Just now saw the video and subscribed the channel

  • @mindcoder4823
    @mindcoder48234 жыл бұрын

    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 ✌️

  • @towritelove6850
    @towritelove68502 жыл бұрын

    Space complexity very well explained !

  • @roshnimandarapu5097
    @roshnimandarapu50972 жыл бұрын

    amazing!!

  • @yomamasofat413
    @yomamasofat4133 ай бұрын

    very good video didnt know it's better to use a loop rather than a recursion for factorial

  • @nelsonberm3910
    @nelsonberm3910Ай бұрын

    Great video

  • @jisavarghese6003
    @jisavarghese60033 жыл бұрын

    Very clear explanation 👌👏

  • @haricharanvalleru4411
    @haricharanvalleru44112 жыл бұрын

    helpful a lot as explanation is really good

  • @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 🙏😊

  • @user-in2vg7ec1n
    @user-in2vg7ec1n2 жыл бұрын

    great video!

  • @brandonlind5700
    @brandonlind5700 Жыл бұрын

    great video

  • @dhonddevameya2362
    @dhonddevameya23624 жыл бұрын

    Touched every corner in the concept. Nice explanation👍

  • @SimpleSnippets

    @SimpleSnippets

    3 жыл бұрын

    Glad you liked it.

  • @_tanujpokhriyal
    @_tanujpokhriyal2 жыл бұрын

    Bhaiya thanks a lot !

  • @sidhartheleswarapu
    @sidhartheleswarapu4 жыл бұрын

    The auxiliary space isn't always dependent on just the call stack size, right? For instance, we may allocate memory within the function.

  • @sriramvadakattu6635
    @sriramvadakattu66353 жыл бұрын

    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 🤟

  • @m.y.m401
    @m.y.m401 Жыл бұрын

    thank you

  • @ViniciuxMariano
    @ViniciuxMariano7 ай бұрын

    Very good Explanation!

  • @SimpleSnippets

    @SimpleSnippets

    7 ай бұрын

    Glad it was helpful!

  • @moonlight-td8ed
    @moonlight-td8ed2 жыл бұрын

    i dont think anyone could explain space complexity as clear as you have explained

  • @hollyj8650
    @hollyj86502 жыл бұрын

    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.

  • @snehendubiswas1032
    @snehendubiswas10323 жыл бұрын

    Till now the best explanation regarding this topic🔥

  • @SimpleSnippets

    @SimpleSnippets

    3 жыл бұрын

    Thank you so much bro 🤘 I'm glad you liked this ☺️

  • @cm-037hemanth8
    @cm-037hemanth8 Жыл бұрын

    Thanks

  • @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!

  • @vd.se.17
    @vd.se.174 жыл бұрын

    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.

  • @karthikgaddam4560
    @karthikgaddam45603 жыл бұрын

    Awesome

  • @hroman_codes
    @hroman_codes3 жыл бұрын

    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

  • @tineitinkymagaso2081
    @tineitinkymagaso20813 жыл бұрын

    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!

  • @amalthiru206
    @amalthiru206 Жыл бұрын

    Amazing video!

  • @SimpleSnippets

    @SimpleSnippets

    Жыл бұрын

    Glad you think so!

  • @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?

  • @solok4150
    @solok41502 жыл бұрын

    Nice 👍

  • @Rahman-bp8jz
    @Rahman-bp8jz2 жыл бұрын

    Thank you thanmay doing great 😘😘😘😘😘😘😘😘😘😘😍😍😍😍😍😍😍😍😍😍 .❤️❤️❤️

  • @daniyalmasood4649
    @daniyalmasood46494 жыл бұрын

    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 😇

  • @somnathghosh3207
    @somnathghosh32072 жыл бұрын

    Super ❤️❤️❤️

  • @iqraashraf8837
    @iqraashraf88374 жыл бұрын

    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 😇

  • @Intellect.Ignite
    @Intellect.Ignite2 жыл бұрын

    nice...........

  • @OlabodeAdedoyin
    @OlabodeAdedoyin4 жыл бұрын

    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 😇

  • @saipavankumark985
    @saipavankumark9854 жыл бұрын

    Really helpful east or west simple snippets is the best

  • @SimpleSnippets

    @SimpleSnippets

    4 жыл бұрын

    Hehe definitely we're the best 😎❤️ Thank you for the compliments 😇

  • @geekaffairs6475
    @geekaffairs64752 жыл бұрын

    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.

  • @ramiroherrera7681
    @ramiroherrera76813 жыл бұрын

    Could you please add some examples with Strings, Objects, HashMaps, List, Arrays, etc

  • @abhisheksinha3119
    @abhisheksinha31193 жыл бұрын

    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.

  • @b.v.vsatyanarayana7410
    @b.v.vsatyanarayana74103 жыл бұрын

    Anna .. how to find auxillary space mathematically ?? You just assume that only how it corrects everywhere??? Plz reply me if anyone can know....

  • @soumyashetti1805
    @soumyashetti18052 жыл бұрын

    you are just too good

  • @SimpleSnippets

    @SimpleSnippets

    2 жыл бұрын

    Thanks Soumya 😊👍 please do share the videos and channel with your friends too 🤟

  • @rahulbarate3954
    @rahulbarate39543 жыл бұрын

    Thank You Brother 👍🏻👌🏻

  • @SimpleSnippets

    @SimpleSnippets

    3 жыл бұрын

    Welcome 👍

  • @sathwikshetty917
    @sathwikshetty9173 жыл бұрын

    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

  • @spatil6884
    @spatil68844 жыл бұрын

    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 🤘

  • @sruthibuddepu2090
    @sruthibuddepu20903 жыл бұрын

    can u pls tell me how the auxillary space value is 4???

  • @gouthamrajkr46
    @gouthamrajkr464 жыл бұрын

    sir for loop it take i*N??

  • @avinashvishwakarma6488
    @avinashvishwakarma64882 жыл бұрын

    It would be much helpful bhaiyya if you provide the drive link of these notes in the description. Awesome content on DSA.

  • @omarz5009
    @omarz50094 жыл бұрын

    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;-)

  • @_just_for_fun_4472
    @_just_for_fun_44723 жыл бұрын

    plz add the time stamps also...it will be really helpful for us...

  • @hgiangphan
    @hgiangphan3 жыл бұрын

    Thank you!

  • @SimpleSnippets

    @SimpleSnippets

    3 жыл бұрын

    You're welcome!

  • @subhashisbhowmik7
    @subhashisbhowmik73 жыл бұрын

    liked and shared

  • @GeetaMunjalMCA
    @GeetaMunjalMCA4 жыл бұрын

    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..

  • @yauriattamimi4435
    @yauriattamimi44357 ай бұрын

    long story in short, space complexity put a high concerns on the auxiliary space compared to the size of the inputs.

Келесі