Python Practice Stack1 || Lesson 28 || Python Placements || Learning Monkey || смотреть онлайн
#pytho #learningmonke #pythoncodin #placement #pythontutorial #pythoncours #pythonforbeginner #pythonfordatascienc #pythonfullcours #pythonprogrammin #pythonfreecourse
Python Practice Stack1
In this class, We do Python Practice Stack1.
Stack Examples
The reader should have prior knowledge of Data Structures and Python. Please check our Data structures course.
For python, Click here.
The examples we discuss help the reader to improve his coding skills. They can easily crack the placement exams.
For improvement, take our practice tests in the placement training course.
Consider the following in_stack
in_stack(Top to Bottom)5,4,3,2,1
What is the content of the out_stack from top to bottom.
after executiong the below function which takes in_stack as parameter.
def alter_stack(in_stack):
out_stack=Stack(5)
while(not in_stack.isempty()):
val=in_stack.pop()
if (not in_stack.isempty()):
temp_val=in_stack.pop()
out_stack.push(val+temp_val)
in_stack.push(temp_val)
else:
out_stack.push(val+2)
return out_stack
In the above example, we must analyze the program and identify the elements present in out_stack after executing the function alter_stack.
The function alter_stack is taking the input stack object In_stack.
The stack class is provided in python. The description of methods of stack class is given in the program.
The while loop in the above program runs till the input_stack is empty.
In the loop, they are taking the top two elements from the input_stack and adding the elements.
The sum value of the top two elements is pushed into out_stack, and the second top element is pushed to in_stack.
Analyze the program for better practice.
Step by step explanation is provided in the video.
After executing the function alter_stack. The stack Out_stack contain elements 3,3,5,7,9. Top to bottom.
Consider the following in_stack and in_list
in_stack(top to bottom)"t","a","e","w","s"
in_list(head to tail) 4-2-1-6
What will be the content of in_stack from top to bottom
after executing the below function where the head of the in_list and in_stack are sent as parameters
def fuction(head,in_stack):
if(head==None):
return
else:
temp_stack=Stack(in_stack.get_max_size())
count1=0
while(not in_stack.isempty()):
element=in_stack.pop()
if (count1 != head.getdata()):
temp_stack.push(element)
count1+=2
while(not temp_stack.isempty()):
in_stack.push(temp_stack.pop())
return function(head.getnext(),in_stack)
In the above example, a stack object and a list object are given as input to the function.
The details of the methods of stack and list class are provided in the program.
The function is taking the head of the list and stack as input.
Analyze the code and identify the elements present in In_stack after executing the function.
Step by step explanation is provided in the video.
For better practice, analyze and then check for a solution.
Output: t,w,s. the elements in the in_stack from top to bottom after execution.
Link for playlists:
https://www.youtube.com/channel/UCl8x4Pn9Mnh_C1fue-Yndig/playlists
Link for our website: https://learningmonkey.in
Follow us on Facebook @ https://www.facebook.com/learningmonkey
Follow us on Instagram @ https://www.instagram.com/learningmonkey1/
Follow us on Twitter @ https://twitter.com/_learningmonkey
Mail us @ [email protected]
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Practice Stack1 || Lesson 28 || Python Placements || Learning Monkey ||» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.