Computers and Technology

Suppose we have a Java class named IntArraystack which uses an array to implement a Stack that holds integers. (a) Write a new method void count PosNeg (IntArrayStack intArrayStackobj) to count and display the number of positive integers and number of negative integers in object intArrayStackobj. In addition, the intArrayStackobj object must be restored to its original state after counting.
(b) Describe the worst-case time complexity of the countPosneg method in Big-Oh notation.
(c) Write a RECURSIVE (NOT iterative) method Boolean sameStack(IntArrayStack stacki, IntArrayStack stack2) to check whether the two stack objects stack1 and stack2 contain the same elements (element order does MATTER). The sameStack method return true if the two input stacks contain the same elements and false otherwise. Note: You can ONLY call push, pop, and peek methods to perform operations on IntArrayStack object. Use o (1) as complexities for push, pop, and peek methods of Stack operations when performing analysis.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 14:10, emfranco1
In a flashdisk wich icon can you use to open files in computer
Answers: 1
image
Computers and Technology, 21.06.2019 21:30, khikhi1705
What elements related to the release and success of the nes console do you see in modern console releases? what elements are no longer relevant to modern console gaming?
Answers: 3
image
Computers and Technology, 23.06.2019 20:00, shaheedbrown06
What software programs are used to to create professional publication? a.) graphics programs b.) word processors c.) page layout programs d.) spreadsheet programs
Answers: 2
image
Computers and Technology, 23.06.2019 23:00, minosmora01
How do you know if the website is secure if you make a purchase
Answers: 2
Do you know the correct answer?
Suppose we have a Java class named IntArraystack which uses an array to implement a Stack that holds...

Questions in other subjects:

Konu
Mathematics, 06.04.2020 23:11