Follow

Translate

Thursday, March 17, 2016

We simulate the operation PUSH(STACK, WWW)

(a)  We simulate the operation PUSH(STACK, WWW):

1.  Since TOP = 3, control is transffered to Step 2.

2. TOP  = 3 + 1 = 4.

3. STACK[TOP] = STACK[4] = WWW.

4.Return.
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

Related Posts:

  • Example Of Factorial Function Example Of Factorial Function:    n! = 1.2.3...............(n-2)(n-1)n 0! = 1             1! = 1         2! = 1.2 = 2     &… Read More
  • PUSH(STACK, TOP, MAXSTK, ITEM) PUSH(STACK, TOP, MAXSTK, ITEM):   This procedure pushes an ITEM onto a stack. 1.   [Stack already filled?]       If TOP = MAXSTK, then: Print:OVERFLOW, and return. 2.  Set … Read More
  • FIBONACCI(FIB, N) FIBONACCI(FIB, N) This procedure calculates FN and returns the value in the first parameter FIB. 1.  If N = 0 or N = 1, then : Set FIB : = N, and return. 2. Call FIBONACCI(FIBA, N-2). 3. Call FIBONACCI(FIBB, N-1… Read More
  • What is Recursion? Recursion:   A recursive must have two proprties (a)  There must be certain criteria, called base criteria, for which the procedure does not call itself. (b)  Each time the procedure does call itself (di… Read More
  • FACTORIAL(FACT, N) Procedure A: FACTORIAL(FACT, N) This procedure calculate N! and returns the value in the variable FACT. 1.  If N = 0, then:Set FACT : = 1, and return. 2.  Set FACT : = 1. [Initializes FACT for loo.] 3.  Re… Read More

0 comments:

Post a Comment