Из-за периодической блокировки нашего сайта РКН сервисами, просим воспользоваться резервным адресом:
Загрузить через dTub.ru Загрузить через ClipSaver.ruУ нас вы можете посмотреть бесплатно Queue Implementation Using an Array Java / Stack Using an Array Java или скачать в максимальном доступном качестве, которое было загружено на ютуб. Для скачивания выберите вариант из формы ниже:
Роботам не доступно скачивание файлов. Если вы считаете что это ошибочное сообщение - попробуйте зайти на сайт через браузер google chrome или mozilla firefox. Если сообщение не исчезает - напишите о проблеме в обратную связь. Спасибо.
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса savevideohd.ru
Java has a Stack class that holds elements of type Object. However, many languages do not provide stack types, so it is useful to be able to define your own. File StackADT.java contains an interface representing the ADT for a stack of objects and ArrayStack.java contains a skeleton for a class that uses an array to implement this interface. Fill in code for the following public methods: _ void push(Object val) _ int pop() _ boolean isEmpty() _ boolean isFull() In writing your methods, keep in mind the following: _ The bottom of an array-based stack is always the first element in the array. In the skeleton given, variable top holds the index of the location where the next value pushed will go. So when the stack is empty, top is 0; when it contains one element (in location 0 of the array), top is 1, and so on. _ Make push check to see if the array is full first, and do nothing if it is. Similarly, make pop check to see if the array is empty first, and return null if it is. _ Popping an element removes it from the stack, but not from the array—only the value of top changes. File StackTest.java contains a simple driver to test your stack. Save it to your directory, compile it, and make sure it works. Note that it tries to push more things than will fit on the stack, but your push method should deal with this. Implement the interface listed below to create a stack class written in Java using an array. In addition, create a driver class that tests your stack class. The specification and implementation of our stack is different from the books implementation, but they are very similar. In Java Implement a stack using an array. Name your stack stackYourLastName.java and your driver stackTesterYourLastName.java. Make your stack size 5, but do not hardcode this. You should be able to change the size for testing purposes with the change of one variable. DO NOT use Stack class defined in JAVA. Implement the following methods in your stack class. -stack() creates an empty stacks, stacks is new and empty. -push(item) adds a new item to the stacks, stacks is modified. -pop() removes and returns an item, stacks is modified. -isEmpty() returns a boolean and tests for an empty stacks, stacks is not modified. -size() returns the int size of the stacks, stacks is not modified -print() prints the stacks from front to rear, stacks is not modified. -top() prints the front element, stacks is not modified. Driver should print the results of the following. -push(redShirt) -push(greenShirt) -push(yellowPants) -push(purpleSock) -push(pinkSocks) -size() -push(blueShirt) -size() -pop() -pop() -size() -pop() -top() -pop() -pop() -size() -isEmpty() Recall that a stack is a linear collection where insertion and deletion occur at one end only. A stack is a last in, first out (LIFO) data structure. The last element to be put on the stack will be the first element that gets removed. Stacks can be applied to numerous programming problems such as the evaluation of arithmetic expressions. An abstract data type (ADT) defines the operations that can be performed on the collection (data structure). Whenever you create a data structure, you should formally list and describe the operations that can be performed on it. That way, you can separate the interface to the collection from the implementation technique used to create it. Operation Description push Adds an element to the top of the stack. pop Removes an element from the top of the stack. peek Examines the element at the top of the stack. isEmpty Returns true if the stack is empty. isFull Returns true if the stack is full. size Returns the number of elements in the stack. public interface StackIntADT { public void push(int element); public int pop(); public int peek(); public boolean isEmpty(); public boolean isFull(); public int size(); } Implementation Notes Your stack class should implement the StackADT interface using an array of ints. The first element entered into your stack should reside at position 0 in the array. You should use a private field named stackPointer, or SP, to hold the index of the next available location within the stack. Both push and pop will modify the stack pointer. You will need to provide at least two constructors for your stack. The default, zero- parameter, constructor should set the stack size to 10. The second constructor should allow the user to specify the number of elements in the stack.