SlideShare a Scribd company logo
Java Foundations
Using Big-O notation, give the running time of the array implementations of each of the
following stack operations. Assume an optimal implementation.
(A) push(item)
(B) pop()
(C) peek()
(D) size()
(E) isEmpty()
(F) clear() (Assume the array elements are nulled out by this operation.)
Multiple Choice options:
a. O(1)
b. O(log n)
c. O(n)
d. O(n log n)
e. O(n^2)
f. O(n^3)
g. O(n!)

More Related Content

More from aanyajoshi90

j-51119ji-01274i- mplify the sum.pdf
j-51119ji-01274i- mplify the sum.pdfj-51119ji-01274i- mplify the sum.pdf
j-51119ji-01274i- mplify the sum.pdfaanyajoshi90
 
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdfIvanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdfaanyajoshi90
 
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdfJocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdfaanyajoshi90
 
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdf
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdfJoe Newbie completed a test to inspect a sample of sales invoices to v.pdf
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdfaanyajoshi90
 
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdfJoan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdfaanyajoshi90
 
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdfITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdfaanyajoshi90
 
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdfIvanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdfaanyajoshi90
 
Jennifer is an older Aboriginal client- She has lived in the city all.pdf
Jennifer is an older Aboriginal client- She has lived in the city all.pdfJennifer is an older Aboriginal client- She has lived in the city all.pdf
Jennifer is an older Aboriginal client- She has lived in the city all.pdfaanyajoshi90
 
Jeff is trying very hard to change his flat tire- He struggles to lift.pdf
Jeff is trying very hard to change his flat tire- He struggles to lift.pdfJeff is trying very hard to change his flat tire- He struggles to lift.pdf
Jeff is trying very hard to change his flat tire- He struggles to lift.pdfaanyajoshi90
 
JCL Inc- is a major chip manufacturing firm that sells its products to.pdf
JCL Inc- is a major chip manufacturing firm that sells its products to.pdfJCL Inc- is a major chip manufacturing firm that sells its products to.pdf
JCL Inc- is a major chip manufacturing firm that sells its products to.pdfaanyajoshi90
 
Jenna is a flight attendant for an international carrier- In the summe.pdf
Jenna is a flight attendant for an international carrier- In the summe.pdfJenna is a flight attendant for an international carrier- In the summe.pdf
Jenna is a flight attendant for an international carrier- In the summe.pdfaanyajoshi90
 
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdfJBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdfaanyajoshi90
 
It's clear that the management is blaming Treece (correctly or incorre.pdf
It's clear that the management is blaming Treece (correctly or incorre.pdfIt's clear that the management is blaming Treece (correctly or incorre.pdf
It's clear that the management is blaming Treece (correctly or incorre.pdfaanyajoshi90
 
Java programming- Applets do not contain ___method setVisible main.pdf
Java programming-  Applets do not contain ___method  setVisible  main.pdfJava programming-  Applets do not contain ___method  setVisible  main.pdf
Java programming- Applets do not contain ___method setVisible main.pdfaanyajoshi90
 
Javascript code I want to use textarea- input(Submit) button when I c.pdf
Javascript code  I want to use textarea- input(Submit) button when I c.pdfJavascript code  I want to use textarea- input(Submit) button when I c.pdf
Javascript code I want to use textarea- input(Submit) button when I c.pdfaanyajoshi90
 
It's not working what am I doing wrong- Given main()- complete the Son.pdf
It's not working what am I doing wrong- Given main()- complete the Son.pdfIt's not working what am I doing wrong- Given main()- complete the Son.pdf
It's not working what am I doing wrong- Given main()- complete the Son.pdfaanyajoshi90
 
Java Programming Help Write a program in Java that encrypts and decryp.pdf
Java Programming Help Write a program in Java that encrypts and decryp.pdfJava Programming Help Write a program in Java that encrypts and decryp.pdf
Java Programming Help Write a program in Java that encrypts and decryp.pdfaanyajoshi90
 
Java programming 15- Code the GUI Form so that each time the Save butt.pdf
Java programming 15- Code the GUI Form so that each time the Save butt.pdfJava programming 15- Code the GUI Form so that each time the Save butt.pdf
Java programming 15- Code the GUI Form so that each time the Save butt.pdfaanyajoshi90
 
Java Programming- Below is the ProgramNode extends Node-java file- The (1).pdf
Java Programming- Below is the ProgramNode extends Node-java file- The (1).pdfJava Programming- Below is the ProgramNode extends Node-java file- The (1).pdf
Java Programming- Below is the ProgramNode extends Node-java file- The (1).pdfaanyajoshi90
 
Java please! Write a program that reads an integer and displays all it.pdf
Java please! Write a program that reads an integer and displays all it.pdfJava please! Write a program that reads an integer and displays all it.pdf
Java please! Write a program that reads an integer and displays all it.pdfaanyajoshi90
 

More from aanyajoshi90 (20)

j-51119ji-01274i- mplify the sum.pdf
j-51119ji-01274i- mplify the sum.pdfj-51119ji-01274i- mplify the sum.pdf
j-51119ji-01274i- mplify the sum.pdf
 
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdfIvanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
 
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdfJocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
 
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdf
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdfJoe Newbie completed a test to inspect a sample of sales invoices to v.pdf
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdf
 
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdfJoan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
 
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdfITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
 
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdfIvanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
 
Jennifer is an older Aboriginal client- She has lived in the city all.pdf
Jennifer is an older Aboriginal client- She has lived in the city all.pdfJennifer is an older Aboriginal client- She has lived in the city all.pdf
Jennifer is an older Aboriginal client- She has lived in the city all.pdf
 
Jeff is trying very hard to change his flat tire- He struggles to lift.pdf
Jeff is trying very hard to change his flat tire- He struggles to lift.pdfJeff is trying very hard to change his flat tire- He struggles to lift.pdf
Jeff is trying very hard to change his flat tire- He struggles to lift.pdf
 
JCL Inc- is a major chip manufacturing firm that sells its products to.pdf
JCL Inc- is a major chip manufacturing firm that sells its products to.pdfJCL Inc- is a major chip manufacturing firm that sells its products to.pdf
JCL Inc- is a major chip manufacturing firm that sells its products to.pdf
 
Jenna is a flight attendant for an international carrier- In the summe.pdf
Jenna is a flight attendant for an international carrier- In the summe.pdfJenna is a flight attendant for an international carrier- In the summe.pdf
Jenna is a flight attendant for an international carrier- In the summe.pdf
 
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdfJBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
 
It's clear that the management is blaming Treece (correctly or incorre.pdf
It's clear that the management is blaming Treece (correctly or incorre.pdfIt's clear that the management is blaming Treece (correctly or incorre.pdf
It's clear that the management is blaming Treece (correctly or incorre.pdf
 
Java programming- Applets do not contain ___method setVisible main.pdf
Java programming-  Applets do not contain ___method  setVisible  main.pdfJava programming-  Applets do not contain ___method  setVisible  main.pdf
Java programming- Applets do not contain ___method setVisible main.pdf
 
Javascript code I want to use textarea- input(Submit) button when I c.pdf
Javascript code  I want to use textarea- input(Submit) button when I c.pdfJavascript code  I want to use textarea- input(Submit) button when I c.pdf
Javascript code I want to use textarea- input(Submit) button when I c.pdf
 
It's not working what am I doing wrong- Given main()- complete the Son.pdf
It's not working what am I doing wrong- Given main()- complete the Son.pdfIt's not working what am I doing wrong- Given main()- complete the Son.pdf
It's not working what am I doing wrong- Given main()- complete the Son.pdf
 
Java Programming Help Write a program in Java that encrypts and decryp.pdf
Java Programming Help Write a program in Java that encrypts and decryp.pdfJava Programming Help Write a program in Java that encrypts and decryp.pdf
Java Programming Help Write a program in Java that encrypts and decryp.pdf
 
Java programming 15- Code the GUI Form so that each time the Save butt.pdf
Java programming 15- Code the GUI Form so that each time the Save butt.pdfJava programming 15- Code the GUI Form so that each time the Save butt.pdf
Java programming 15- Code the GUI Form so that each time the Save butt.pdf
 
Java Programming- Below is the ProgramNode extends Node-java file- The (1).pdf
Java Programming- Below is the ProgramNode extends Node-java file- The (1).pdfJava Programming- Below is the ProgramNode extends Node-java file- The (1).pdf
Java Programming- Below is the ProgramNode extends Node-java file- The (1).pdf
 
Java please! Write a program that reads an integer and displays all it.pdf
Java please! Write a program that reads an integer and displays all it.pdfJava please! Write a program that reads an integer and displays all it.pdf
Java please! Write a program that reads an integer and displays all it.pdf
 

Recently uploaded

The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationDelapenabediema
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfbu07226
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXMIRIAMSALINAS13
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxJenilouCasareno
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...Nguyen Thanh Tu Collection
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfjoachimlavalley1
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportAvinash Rai
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chipsGeoBlogs
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePedroFerreira53928
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativePeter Windle
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxricssacare
 

Recently uploaded (20)

The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdfINU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
INU_CAPSTONEDESIGN_비밀번호486_업로드용 발표자료.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Industrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training ReportIndustrial Training Report- AKTU Industrial Training Report
Industrial Training Report- AKTU Industrial Training Report
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptxJose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
Jose-Rizal-and-Philippine-Nationalism-National-Symbol-2.pptx
 

Java Foundations Using Big-O notation- give the running time of the ar.pdf

  • 1. Java Foundations Using Big-O notation, give the running time of the array implementations of each of the following stack operations. Assume an optimal implementation. (A) push(item) (B) pop() (C) peek() (D) size() (E) isEmpty() (F) clear() (Assume the array elements are nulled out by this operation.) Multiple Choice options: a. O(1) b. O(log n) c. O(n) d. O(n log n) e. O(n^2) f. O(n^3) g. O(n!)