CSE 214 Lecture Notes - Lecture 3: Machine Code

26 views3 pages

Document Summary

A stack is a sequence of data elements (of the same type) arranged one after another conceptually. An element can be added to the top of the stack only. ( push ) An element can be removed from the top of the stack only ( pop ) Operating systems: keeping track of method calls in a running program. Compilers: conversion of arithmetic expressions to machine code. Constructor: create an empty stack isempty: is the stack empty push: push an element on to the top of the stack (if the stack is not full) Pop: remvoe the top of the element from the stack (if the stack is not empty) peek: examine the top element of the stack without removing it (if the stack is not empty) Size: return the number of elements on the stack. 9 public class intstack implements cloneable{ public final int capacity = 100; private int[] data; private int top;

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents