







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








Summat iv e Feedba ck: Resubm issio n Feedba ck:
Figure 1. Abstract data type model There are 3 main types of ADTs: Figure 2. 3 main Types of ADTs List ADT
Figure 3. types of list
Figure 7. push and pop of stack Example: Push(): First create a new Integer stack called stack, then use for loo to push I into stack ad the result will be: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Figure 8.Push example Pop(): we use pop to remove an element out of stack, pop operator return a element that have been popped.
Figure 11. Pop and push of memory stack
(Joseph Yiu, 2015) whenever a function is called a new stack frame is created with all the function’s data and this stack frame is pushed in the program stack, and the stack pointer that always points the top of the program stack points the stack frame pushed as it is on the top of the program stack. (Prakash, 2020) Example: Step 1: when running program, when main function was founded java runtime will create a memory stack and will be used by main()
# Operation Pre-condition Post-condition Error-condition 1 Push(Integer i) s.isFull() == False s.Size() == n+1, Peek() == i s.isFull() == False 2 Pop( ): Integer s.isEmpty() == False,peek()=y s.Size() == n-1, Pop() = y s.isEmpty() == True 3 Peek( ): Integer s.isEmpty() == False s.Size()==n s.isEmpty() == True 4 isFull( ): Boolean None s.Size() == maxSize None 5 isEmpty( ): Boolean None s.Size() < 0 None 6 Size(): Integer None returns the number of elements in the stack None Variable describe: