COIS 2020H Lecture 2: Stack class:
Document Summary
Int [ ] a | a= new int [6] If we need to insert a number in position 2, we move the number in the last position to the right. Move down when we insert [i ++] Sending the value when we retrieve: singly linked list. Currant. next = i ++ p. next = curr. next curr. next = p curr. next = curr. next. next: doubly linked list. If ( count < capacity && ( pos >= 0 && pos. For ( i = pos +1 ; i <= count -1; i++) Element [ i -1 ] = elemet [i] If ( pos >= 0 && pos <= count -1) The behaver is last in, first out. (loif) It"s also a generic class, you can put whatever you want in this class: array, capacity 6, element t [ , top index = -1 , that it"s mean empty.