Data structures: Array implementation of stacks

  Рет қаралды 850,187

mycodeschool

mycodeschool

10 жыл бұрын

See complete series on data structures here:
• Data structures
In this lesson, we have discussed array based implementation of stack data structure.
Source Code:
C code: gist.github.com/mycodeschool/...
C++ code (Object oriented implementation) : gist.github.com/mycodeschool/...
Time complexity of push for dynamic array implementation:
If we start with an array of size 1 and keep doubling the size with each overflow, for n pushes.. cost of copy will be
(1 + 2 + 4 + 8 + ... + n/2 + n)
= n *( 1+ 1/2 + 1/4 + 1/8 + ... 1/n) - taking out n
= n*2 - the expression in bracket above will evaluate to 2.
So, cost of copy in n pushes = O(n)
Cost of n normal pushes = O(n) - each push takes constant time
Total cost of n pushes = O(n)
Average cost of 1 push = O(1).
For practice problems and more, visit: www.mycodeschool.com
Like us on Facebook: / mycodeschool
Follow us on twitter: / mycodeschool

Пікірлер: 299
@iftekharjitu4161
@iftekharjitu4161 3 жыл бұрын
The tutorial is from 2013, and I am from 2021, seems like it will never get old. God bless you
@shubhamkapoor3973
@shubhamkapoor3973 3 жыл бұрын
g old
@mateovajda6078
@mateovajda6078 6 ай бұрын
2023 anyone?😅
@emmojo3428
@emmojo3428 9 жыл бұрын
As a hearing impaired beginning programmer, I want to thank you sincerely for the captions. You have just earned a subscription from me, which is unique given that I don't have any other subscriptions. Keep up the great work.
@mycodeschool
@mycodeschool 9 жыл бұрын
Jamaika I am very glad that you are getting helped. :)
@gamereplayhq
@gamereplayhq 8 жыл бұрын
+Jamaika (y) THIS COMMENT MADE MY DAY :D
@SonuSonu-tk5pk
@SonuSonu-tk5pk 7 жыл бұрын
why ? doesn't c taught in ur country?
@priyavratkumar4296
@priyavratkumar4296 7 жыл бұрын
Sonu Sonu sabse yahin puchega?
@ashishagrawal1406
@ashishagrawal1406 6 жыл бұрын
1. Check your English Before Commenting. 2. One can watch KZbin videos irrespective of the fact that the thing is being taught in their country. 3. Stop spamming KZbin with foolish comments.
@Danieljohnson-sh7iq
@Danieljohnson-sh7iq 6 жыл бұрын
OMG whoever did and organize this tutorial God will bless him. I have went through 13 executive tutorials on stack i still didn't get it, but once i watch this video, it's as if the tutor transfered the knowledge to my brain straight LOL. Once again thank you, am subscribing.
@smitasharma2979
@smitasharma2979 8 жыл бұрын
I have gone through all your data-structures videos and I really like the way you explain. I appreciate the content as well as the clarity of the voice and flow.
@sarojhkalyan1527
@sarojhkalyan1527 2 жыл бұрын
Thank you for making this video. Explanations from others didn't get me to understand this concept as thoroughly as yours did.
@virenbhanushali9282
@virenbhanushali9282 6 жыл бұрын
The clearity of your words just blew my mind.keep you work on
@kevinrocky4443
@kevinrocky4443 4 жыл бұрын
Anyone else feel like you learned more from this than in college?
@vladalbescu4153
@vladalbescu4153 9 жыл бұрын
Array Stack of Winterfell.
@JustGamerStuff
@JustGamerStuff 8 жыл бұрын
+Vlad Albescu up u go
@jeepreparationsfunny7199
@jeepreparationsfunny7199 5 жыл бұрын
Ded
@meetparmar1281
@meetparmar1281 5 жыл бұрын
valar mugulish
@shreypatel9379
@shreypatel9379 4 жыл бұрын
THE NORTH REMEMBERS....
@rahulsubramanian3417
@rahulsubramanian3417 4 жыл бұрын
legend
@MatheusLB2009
@MatheusLB2009 7 жыл бұрын
Your video makes the internet a better place
@israa6280
@israa6280 5 жыл бұрын
Matheus Lacerda so agreed
@PokeDubzTCG
@PokeDubzTCG 8 жыл бұрын
Your videos are great! Thanks for the clear explanations, as my current CSC-250 professor doesn't give us much information on these forms of data structures.
@Calm_Energy
@Calm_Energy 6 жыл бұрын
I really appreciate how you give me the words to describe the connection between the pseudo-code and Big O notation. For ex. "two scenarios in a push operation," then you show the details between constant time for a normal push operation then O(n) for an overflow correction using a larger array. Next you say "the time complexity of push with this strategy" O(1) in best case, O(n) in worst. Plus the pseudo-code really helps!
@yilingl.8756
@yilingl.8756 10 жыл бұрын
This helps so so so much!! Thank you for the clear explanation.
@PurnenduMondal_
@PurnenduMondal_ 6 жыл бұрын
Sir You bring my Confidence Back.....Thank you a Lot...for all of your Videos
@PC-ky3qo
@PC-ky3qo 6 жыл бұрын
This is the best explanation i could ever get on array implementation of stack. thank you very much
@amitech1992
@amitech1992 10 жыл бұрын
Great tutorial and nice accent, easily understandable. U reduced my work to Google a lot and then go through too many pages to understand these concepts for my College viva.
@RenuSharma-zb2bz
@RenuSharma-zb2bz 3 жыл бұрын
One good thing is that while explaining the data structures not any particular language is used so it is easy for any language study to watch this video
@fay_chong
@fay_chong 7 жыл бұрын
Hi, I consider myself rather green when it comes to programming and I have legit no idea what my professor has been teaching until I found this video. Thank you so much for your clear explanation. :) This video is super helpful!
@bihator
@bihator 8 жыл бұрын
You are absolutely amazing man !!
@CSEconceptswithParinita
@CSEconceptswithParinita 4 жыл бұрын
Thank you so much sir! You're an inspiration for new tutors like me🙏
@babruwankshirsagar6390
@babruwankshirsagar6390 9 жыл бұрын
keep doing it. it is really work as helping hand for many of us..thank you.
@daveboyle76
@daveboyle76 3 жыл бұрын
You're explanation is clear and concise. Far superior to the text provided with our course. Thank you.
@MicroNG
@MicroNG 2 жыл бұрын
please check the details
@nehahanwate7322
@nehahanwate7322 5 жыл бұрын
thanks for this good explanation and clearing the concept
@douglasdavisv
@douglasdavisv 8 жыл бұрын
i can feel the dedication from your each word.thank you for the information.i killed the subscribe button .#feeling informative with my code school
@tuankietdang7285
@tuankietdang7285 6 жыл бұрын
Just what I need, thank you for your informative video
@noaido9803
@noaido9803 4 жыл бұрын
All the lessons are great! Thank you!
@MicroNG
@MicroNG 2 жыл бұрын
please check the details
@skywolf6984
@skywolf6984 10 жыл бұрын
Your videos amazing man , thanks for sharing them they help a lot. Keep up good work =)
@sreekeshv12
@sreekeshv12 7 жыл бұрын
thanks bro I understood the topic very well you earned yourself a subscriber
@everfresh9693
@everfresh9693 7 жыл бұрын
Nice video dude!! It helped alot, keep up the great work
@aricktanwar7436
@aricktanwar7436 5 жыл бұрын
One of the talented person who knows data structures as mother tongue he will be the only reason i pass my examination
@usmanabdurrahman2461
@usmanabdurrahman2461 8 жыл бұрын
Tommorow's my final.Bless you 😂😂
@samarthshetty1810
@samarthshetty1810 5 жыл бұрын
I really don't understand why few disliked, this made me understand concepts of stack well.
@sowjanyayellumahanti8460
@sowjanyayellumahanti8460 7 жыл бұрын
this explanation helped me a lot sir. thank you very much
@RajendraSingh-kv7df
@RajendraSingh-kv7df 6 жыл бұрын
Sir this is very very clearly and amazingly explained video Thank u very much
@chetanyat4632
@chetanyat4632 9 жыл бұрын
u r d best in dis business :) thankyou soo much for such beautiful and easy to understand explanations :D #appreciate#your#work :)
@semirumutkurt6635
@semirumutkurt6635 7 жыл бұрын
give this man a medal
@carefree_ladka
@carefree_ladka 5 жыл бұрын
Really loved your lectures bro 😊 .. helpful
@mohitbv2331
@mohitbv2331 8 жыл бұрын
Thank you. God bless you. Keep it up.
@tusharjajodia9077
@tusharjajodia9077 3 жыл бұрын
Still the Best Tutorial in the platform
@patrikhyll4301
@patrikhyll4301 7 жыл бұрын
thank you a lot!!! a great series!
@adityabokkisum1000
@adityabokkisum1000 5 жыл бұрын
really u saved my day man a big thank for u
@abdelmajidkansoussi6904
@abdelmajidkansoussi6904 2 жыл бұрын
thank you man , this was very helpful. God bless you.
@zannylover2898
@zannylover2898 4 жыл бұрын
No word for this kind of knowledge,simply fr m the best in the world ,where are u sir plz comeback we want more videos from you,plzzz sir help u truly the best in the world.
@KistlakRajapakshaSevenNet
@KistlakRajapakshaSevenNet 8 жыл бұрын
Thank U Very Much Bro !! :D
@mycodeschool
@mycodeschool 10 жыл бұрын
We wish that too :)
@VinayKumar-vm1hg
@VinayKumar-vm1hg 4 жыл бұрын
Sir how top=max_size-1
@jeetsharma9892
@jeetsharma9892 3 жыл бұрын
@@VinayKumar-vm1hg If you understood please explain it to me as well.
@AmanSharma-ht5zq
@AmanSharma-ht5zq 3 жыл бұрын
@@VinayKumar-vm1hg In most programming languages, the arrays are implemented as 0 based index. Let's say there are 2 elements in an array, so its max_size = 2, and there are only two indices - 0, 1. So the variable top should be equal to 1, hence top = max_size-1;
@vyshuvysh2502
@vyshuvysh2502 6 жыл бұрын
explanation is done very well... thanks
@jayp1638
@jayp1638 10 жыл бұрын
Amazing video Buddy :)
@XieQiu
@XieQiu 8 жыл бұрын
very clear. thank you!
@dodgywarden8788
@dodgywarden8788 5 жыл бұрын
Thankyou so much. Now i can Write Stack code on my own
@chenghuapang7504
@chenghuapang7504 7 жыл бұрын
so easy! you did a better job than my professor...
@ys2313
@ys2313 5 жыл бұрын
Thanks Sir. it helped me a lot.
@nandangupta727
@nandangupta727 9 жыл бұрын
awesome tutorial of DS .. thnku so much.. :)
@welkin102
@welkin102 10 жыл бұрын
i really wish that you guys had started this video-makings a year before !!
@NaveenKumarErroju
@NaveenKumarErroju 7 жыл бұрын
fabulous explanation...
@chilinouillesdepommesdeter819
@chilinouillesdepommesdeter819 6 жыл бұрын
Great job!
@srinaath9845
@srinaath9845 6 жыл бұрын
thank u so much..i am very grateful to you
@cagrkaymak3063
@cagrkaymak3063 9 жыл бұрын
really nice job, u helped me a lot
@himanshusattavan1335
@himanshusattavan1335 7 жыл бұрын
My code school, just simply rocks........
@estebanlopez1701
@estebanlopez1701 4 жыл бұрын
damn this video is impressive, thanks a lot man
@syedfilms4447
@syedfilms4447 4 жыл бұрын
amazing woaww i learn first time from your this tutorial and understand stack with array too much easily thansk sir
@MicroNG
@MicroNG 2 жыл бұрын
please check the details
@rudreshjha7166
@rudreshjha7166 8 ай бұрын
Nice explanation man
@irving99uk
@irving99uk 8 жыл бұрын
Really good thank you.
@rztutul8824
@rztutul8824 7 жыл бұрын
Thanks ...excellent video ..
@usama57926
@usama57926 6 жыл бұрын
thank u for mathematical explanation
@user-eh5ze4nw4z
@user-eh5ze4nw4z 10 жыл бұрын
very good, thanks
@shivangisrivastava1158
@shivangisrivastava1158 3 жыл бұрын
love your voice man 💯
@sarweswaranss5526
@sarweswaranss5526 4 жыл бұрын
Perfect teaching..Finally i learnt tq u so much..
@MicroNG
@MicroNG 2 жыл бұрын
please check the details
@HabiburRahman-xs9gb
@HabiburRahman-xs9gb 7 жыл бұрын
simple and clear...just awssm
@thapelomokgwaphe3005
@thapelomokgwaphe3005 9 жыл бұрын
thank you very much,wish u wer my lecturer
@josiahsamson6022
@josiahsamson6022 8 жыл бұрын
Very understandable,,,,,,,,,,,
@mustafaali9128
@mustafaali9128 7 жыл бұрын
I love your clases!
@sanyog312
@sanyog312 9 жыл бұрын
thanks it was very helpfull
@mounica.b5344
@mounica.b5344 10 жыл бұрын
awesome tutorial ,pls keep more videos on trees and graphs in c++(oop) language
@ramakrishnan4356
@ramakrishnan4356 6 жыл бұрын
u saved me from my exam thx a lot bro
@kal5211
@kal5211 3 жыл бұрын
Excellent.
@AbhishekYadav-hs4ix
@AbhishekYadav-hs4ix 2 жыл бұрын
Thank You Sir!!
@HuthaifaMady1992
@HuthaifaMady1992 9 жыл бұрын
Wonderful ... Thanks,,
@prasadbandaru6498
@prasadbandaru6498 5 жыл бұрын
Good one!
@TheJust4give
@TheJust4give 9 жыл бұрын
I am becoming a big time fan of your lessons. Do you have any lesson on AVL ? I was not able to find one from your list.
@Naveen-ef2dg
@Naveen-ef2dg 6 жыл бұрын
Well Made!!
@akhilgupta3664
@akhilgupta3664 4 жыл бұрын
Thank you !!
@melissahong1
@melissahong1 6 жыл бұрын
4:10 - "We do not care what garbage lies there" Hahaha
@user-mc1eb1sg5x
@user-mc1eb1sg5x 6 жыл бұрын
mean bully I think you are the one with the garbage face and you're trying to feel good by posting sh*t in the internet. Get a life man.
@FatmaYousuf
@FatmaYousuf 6 жыл бұрын
Grove Street calm your balls
@shubhangisoni1668
@shubhangisoni1668 6 жыл бұрын
By garbage ,he meant garbage value , that is a typical word in programming vocabulary ,used to describe unwanted value /data .
@ujjwalb7406
@ujjwalb7406 5 жыл бұрын
Garbage value is a thing!!
@dancinglikecrazy5510
@dancinglikecrazy5510 3 жыл бұрын
@@user-mc1eb1sg5x wtf💀💀💀🤣🤣🤣 you okay my guy?
@rownitakhanam5013
@rownitakhanam5013 5 жыл бұрын
This video is very helpful.I was going hardtime for perceiving the concepts.And I got poor marks.Now I have started to understand by Mercy of Allah.Thanks a lot for this video.
@075_ritikkumar7
@075_ritikkumar7 4 жыл бұрын
Har cheej me allah ko ghusa do. Thank to this great tutor , not allah.
@rownitakhanam5013
@rownitakhanam5013 4 жыл бұрын
@@075_ritikkumar7 It is always Allah (The One and Only God) who always helps me for everything. He is the Rahman( The beneficent)has created us from mingled sperm. I also thanked this tutor who has helped me. But if I loose my brain power ,then this tutor can help me no more despite his talent. Because I was depressed for many years. Even I was going to attempt suicide .At that time, it was hard for me to study and understand hard concepts. Fortunately, Allah guided me through HIs Scripture 'The Quran' and helped me to overcome my depression. Finally, I have found a new meaning of my life.
@rownitakhanam5013
@rownitakhanam5013 4 жыл бұрын
@@075_ritikkumar7 Allah is the most wise.He created everything with exact meaaure through His knowledge He has knowledge about both seen and unseen.
@rownitakhanam5013
@rownitakhanam5013 4 жыл бұрын
@@075_ritikkumar7 Try to respect every religion. And before commenting also read scripture of respective religion
@wayoflife3098
@wayoflife3098 5 жыл бұрын
Thank you sir 😊
@gogogege2009
@gogogege2009 10 жыл бұрын
Thanks :)
@shreeshkatti2929
@shreeshkatti2929 8 жыл бұрын
awesome one
@DMSAProductions
@DMSAProductions 9 жыл бұрын
Thank you very much! I have been trying all over again to creat something similar without any success!!! THANK YOU!!!! You helped me a lot!
@jagadeeshr91
@jagadeeshr91 5 жыл бұрын
Good explanation
@akhtarabbas5760
@akhtarabbas5760 6 жыл бұрын
thanks alot sir
@DASARITUTS
@DASARITUTS 9 жыл бұрын
thanks good explanation,sir which microphone do you use for recording.
@AspirantNoteBooks
@AspirantNoteBooks 8 жыл бұрын
Earned a subscription from me TOO :)
@usama57926
@usama57926 6 жыл бұрын
amazing
@royal9063
@royal9063 3 жыл бұрын
My wish is to free and quality education for all. I don't know how many of you are doing this work. But I wish to God to give a healthy and prosperous life to all of you. Bcoz you r doing a great work. Plz make more videos. You know about India's privet college. they are just useless. You have a great quality to teach everything in simple way. Plz help me help us to become a Good engineer from privets college. We want more videos. Plz make more videos.
@MicroNG
@MicroNG 2 жыл бұрын
please check the details
@TechnoForbes
@TechnoForbes 8 жыл бұрын
Thanks a lot ..
@25sanjeevlamba
@25sanjeevlamba 6 жыл бұрын
sir, may i know for such a excellent presentation which software do u use?
@its_rohitp
@its_rohitp 7 жыл бұрын
thanks...
@rashmipandey7957
@rashmipandey7957 7 жыл бұрын
thank you
@mohammadismail9336
@mohammadismail9336 5 жыл бұрын
very nice
@UniVerse-xm9cy
@UniVerse-xm9cy 8 жыл бұрын
thanks!
@anuragghosh9710
@anuragghosh9710 6 жыл бұрын
brilliant
@maaz6912
@maaz6912 5 жыл бұрын
In the top function, where the line " return A[top]; " is there, the compiler throws out an error that "array subscript is not an integer". And yes, my function starts with int, not void.
Data Structures: Linked List implementation of stacks
10:58
mycodeschool
Рет қаралды 633 М.
Check for balanced parentheses using stack
14:13
mycodeschool
Рет қаралды 470 М.
Nutella bro sis family Challenge 😋
00:31
Mr. Clabik
Рет қаралды 13 МЛН
마시멜로우로 체감되는 요즘 물가
00:20
진영민yeongmin
Рет қаралды 25 МЛН
Does size matter? BEACH EDITION
00:32
Mini Katana
Рет қаралды 17 МЛН
Data structures: Introduction to stack
8:26
mycodeschool
Рет қаралды 602 М.
Hash Tables and Hash Functions
13:56
Computer Science
Рет қаралды 1,5 МЛН
Pointers and dynamic memory - stack vs heap
17:26
mycodeschool
Рет қаралды 1,4 МЛН
Reverse a string or linked list using stack.
16:25
mycodeschool
Рет қаралды 383 М.
every good programmer should know how to code this data structure (its easy)
21:08
Evaluation of Prefix and Postfix expressions using stack
14:10
mycodeschool
Рет қаралды 627 М.
Data structures: Binary Tree
16:17
mycodeschool
Рет қаралды 1,4 МЛН
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 765 М.
Array vs. ArrayList in Java Tutorial - What's The Difference?
17:36
Coding with John
Рет қаралды 503 М.
Data Structures: Arrays vs Linked Lists
12:16
mycodeschool
Рет қаралды 790 М.
Nutella bro sis family Challenge 😋
00:31
Mr. Clabik
Рет қаралды 13 МЛН