Question

In: Computer Science

What does the following pseudocode axiom mean, in English? 1. ( aStack.push( item ) ).pop() =...

What does the following pseudocode axiom mean, in English?

1. ( aStack.push( item ) ).pop() = aStack

2. aList.getLength() = ( aList.insert( i, item ) ).getLength() - 1

3. ( aList.insert( i, item ) ).remove( i ) = aList

4. aList.getEntry( i ) = ( aList.insert( i, item ) ).getEntry( i+1 )

Solutions

Expert Solution

Please let me know in case of any issue

1. ( aStack.push( item ) ).pop() = aStack
   pishing an item in stack and then removing, it means stack came in same state as it was before these two operation

2. aList.getLength() = ( aList.insert( i, item ) ).getLength() - 1

   length of list = length if list that has one more element - 1

3. ( aList.insert( i, item ) ).remove( i ) = aList
   Adding an item at index i, then removing same item, that means list has same set of elements as
   it was before these two operation
4. aList.getEntry( i ) = ( aList.insert( i, item ) ).getEntry( i+1 )
  
       aList.getEntry( i ) =>getting an elemets at index i
       aList.insert( i, item ) => insert an item at i
       ( aList.insert( i, item ) ).getEntry( i+1 ) => inserting an item at index i and then getting elemnts from index (i+1)


Related Solutions

a) What is Praxeology? b) What is the fundamental axiom of praxeology and what does it...
a) What is Praxeology? b) What is the fundamental axiom of praxeology and what does it mean to employ a means-ends framework? c) What does it mean to say praxeology is not empirical?
Write a pseudocode for the following code: /*every item has a name and a cost */...
Write a pseudocode for the following code: /*every item has a name and a cost */ public class Item {    private String name;    private double cost;    public Item(String name, double cost) {        this.name = name;        this.cost = cost;    }    public String getName() {        return name;    }    public void setName(String name) {        this.name = name;    }    public double getCost() {        return cost;...
1. For each item, write what is required using only English words. (a) (2 Pts.) The...
1. For each item, write what is required using only English words. (a) (2 Pts.) The converse, contrapositive, inverse and negation of \If George feels well, then George is is going to a movie or going dancing". (b) (2 Pts.) The converse, contrapositive, inverse and negation of \Anna is failing history and psychology, then Anna is not graduating". (c) (2 Pts.) The statement represented by the symbols below and the negation of such statement: 8s9c (M(s) ! (D(c) ^ T(s;...
What does it mean for a catalog to be self-describing? What does the following query mean?
DBMS:What does it mean for a catalog to be self-describing? What does the following query mean?((TABLES JOIN COLUMNS) WHERE COLCOUNT < 3) [TABNAME, COLNAME]
1. In Java, what does the last line mean? What does scan.nextLine(); mean?
1. In Java, what does the last line mean? What does scan.nextLine(); mean?import java.util.Scanner;Scanner scan = new Scanner (System.in);message = scan.nextLine();2. Assuming that a Random object has been created called generator, what is the range of the result of each of the following expressions? Also, do each example using nextFloat()•generator.nextInt(20)•generator.nextInt(8) + 1•generator.nextInt(100) – 50
The following problem should be done in pseudocode. Problem 1 The programmer intends for this pseudocode...
The following problem should be done in pseudocode. Problem 1 The programmer intends for this pseudocode to display three random numbers in the range of 1 through 7. According to the way we've been generating random numbers in the book; however, there appears to be an error. Assume that the random() function is a built-in library function. Correct the pseudocode so that the program works as it should (This has 1 error and is easy to spot) //This program displays...
What does it mean when a cost-capacity factor is less than 1? What does it mean...
What does it mean when a cost-capacity factor is less than 1? What does it mean when it is greater than 1?
1. What does it mean for a sample to be representative?
1. What does it mean for a sample to be representative?
1. What does the word “marginal” mean? 2. What does the phrase “marginal analysis” mean? 3....
1. What does the word “marginal” mean? 2. What does the phrase “marginal analysis” mean? 3. What does marginal revenue mean? 4. What does marginal cost mean? 5. What does marginal profit mean? How are marginal revenue and marginal cost related to marginal profit? 6. Recall that profit is like a hill; it goes up and then it goes down. Our goal as a firm is to choose the value of Q that gets us to the top of the...
What does it mean to have a good life? What does it mean to be a...
What does it mean to have a good life? What does it mean to be a good person?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT