SlideShare a Scribd company logo
If top of the stack will be at position 0, then time complexity for operations:
1. push() : O(n) => you need to pop all elements then push at postion 0 then again insert all
poped elements
2. pop() : O(n) => first go to postion 0 then push all other elemnts
3. top() : O(n) => pop all other elements to get 0th element
Solution
If top of the stack will be at position 0, then time complexity for operations:
1. push() : O(n) => you need to pop all elements then push at postion 0 then again insert all
poped elements
2. pop() : O(n) => first go to postion 0 then push all other elemnts
3. top() : O(n) => pop all other elements to get 0th element

More Related Content

PDF
Properties of enantiomers Their NMR and IR spec.pdf
PDF
O2 will be released as Na+ will not get reduce bu.pdf
PDF
Huntingtons disease and other hereditary diseas.pdf
PDF
ionic character BaF MgO FeO SO2 N2 .pdf
PDF
Nitrogen can hold up to 4 bonds. In sodium amide.pdf
PDF
C. hydrogen bonding. between N and H of differen.pdf
PDF
  import java.util.;import acm.program.;public class FlightPla.pdf
PDF
We Know that    Amines are generally basic in naturebecause of th.pdf
Properties of enantiomers Their NMR and IR spec.pdf
O2 will be released as Na+ will not get reduce bu.pdf
Huntingtons disease and other hereditary diseas.pdf
ionic character BaF MgO FeO SO2 N2 .pdf
Nitrogen can hold up to 4 bonds. In sodium amide.pdf
C. hydrogen bonding. between N and H of differen.pdf
  import java.util.;import acm.program.;public class FlightPla.pdf
We Know that    Amines are generally basic in naturebecause of th.pdf

More from anushasarees (20)

PDF
There are so many java Input Output classes that are available in it.pdf
PDF
Three are ways to protect unused switch ports Option B,D and E is.pdf
PDF
The water turns green because the copper(II)sulfate is breaking apar.pdf
PDF
The mutation is known as inversion. In this a segment from one chrom.pdf
PDF
The main organelles in protein sorting and targeting are Rough endop.pdf
PDF
Successfully supporting managerial decision-making is critically dep.pdf
PDF
SolutionTo know that the team has identified all of the significa.pdf
PDF
Solutiona) Maximum bus speed = bus driver delay + propagation del.pdf
PDF
Solution Polymerase chain reaction is process in which several co.pdf
PDF
Doubling [NO] would quadruple the rate .pdf
PDF
Correct answer F)4.0 .pdf
PDF
D.) The system is neither at steady state or equi.pdf
PDF
public class Team {Attributes private String teamId; private.pdf
PDF
Pr(E) shows the probability of only event E happening.Pr(F) shows .pdf
PDF
Pneumothorax The presence of abnorma air in the chest cavity outsi.pdf
PDF
Perhaps too much has been written about the debate surrounding Nicho.pdf
PDF
NADH produced in the cytoplasm produces two to th.pdf
PDF
I keep getting C... .pdf
PDF
HA = H+ + A-pH = -log[H+] = 4.0[H+] = 10-pH = 10-4 MPercent .pdf
PDF
Generally polar compounds are soluble in polar solvents and non-pola.pdf
There are so many java Input Output classes that are available in it.pdf
Three are ways to protect unused switch ports Option B,D and E is.pdf
The water turns green because the copper(II)sulfate is breaking apar.pdf
The mutation is known as inversion. In this a segment from one chrom.pdf
The main organelles in protein sorting and targeting are Rough endop.pdf
Successfully supporting managerial decision-making is critically dep.pdf
SolutionTo know that the team has identified all of the significa.pdf
Solutiona) Maximum bus speed = bus driver delay + propagation del.pdf
Solution Polymerase chain reaction is process in which several co.pdf
Doubling [NO] would quadruple the rate .pdf
Correct answer F)4.0 .pdf
D.) The system is neither at steady state or equi.pdf
public class Team {Attributes private String teamId; private.pdf
Pr(E) shows the probability of only event E happening.Pr(F) shows .pdf
Pneumothorax The presence of abnorma air in the chest cavity outsi.pdf
Perhaps too much has been written about the debate surrounding Nicho.pdf
NADH produced in the cytoplasm produces two to th.pdf
I keep getting C... .pdf
HA = H+ + A-pH = -log[H+] = 4.0[H+] = 10-pH = 10-4 MPercent .pdf
Generally polar compounds are soluble in polar solvents and non-pola.pdf

Recently uploaded (20)

PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
master seminar digital applications in india
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Classroom Observation Tools for Teachers
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
master seminar digital applications in india
VCE English Exam - Section C Student Revision Booklet
Abdominal Access Techniques with Prof. Dr. R K Mishra
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
GDM (1) (1).pptx small presentation for students
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
O7-L3 Supply Chain Operations - ICLT Program
Final Presentation General Medicine 03-08-2024.pptx
A systematic review of self-coping strategies used by university students to ...
Classroom Observation Tools for Teachers
Orientation - ARALprogram of Deped to the Parents.pptx
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Microbial disease of the cardiovascular and lymphatic systems
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape

If top of the stack will be at position 0, then time complexity for .pdf

  • 1. If top of the stack will be at position 0, then time complexity for operations: 1. push() : O(n) => you need to pop all elements then push at postion 0 then again insert all poped elements 2. pop() : O(n) => first go to postion 0 then push all other elemnts 3. top() : O(n) => pop all other elements to get 0th element Solution If top of the stack will be at position 0, then time complexity for operations: 1. push() : O(n) => you need to pop all elements then push at postion 0 then again insert all poped elements 2. pop() : O(n) => first go to postion 0 then push all other elemnts 3. top() : O(n) => pop all other elements to get 0th element