O GoConqr está de visual novo! Conte para nós o que você achou.

Flashcards

Stacks

Ariana Parr Computer Science A level Inglês 8 flashcards

Flashcards do conjunto (8)

  1. 1What is a stack?A method for handling linear lists of data. Data is added/removed from the top of the structure. Known as Last In, First Out.
  2. 2What are the basic operations of a stack?Adding/Removing from the top. Checking if stack is empty/full
  3. 3What is a stack pointer?The top of the stack where data can be added. It will determine whether the stack is full or not.
  4. 4What happens if a stack is full or empty?An error message needs to be displayed.
  5. 5How do you push something onto a stack?* check if tail pointer is equal to max
    * if so, output 'queue is full'
    * if not increase tail pointer by 1
    * then insert data in position of updated tail pointer
  6. 6How do you pop something from a stack?* check if head pointer is greater than tail pointer
    * if so, output queue is empty
    * if not, increase head pointer by 1
    * then output data from position of updated head pointer.
  7. 7what is the pseudocode for the stack push algorithm?function push(newItem)
    newItem = input("Enter")
    max = 10
    if stackPointer> max then
    print ('queue is full')
    else
    stackPointer= stackPointer+ 1
    stackPointer[stackPointer] = newItem
    print (Item Added)
    endif
    endfunction
  8. 8what is the pseudocode for the stack pop algorithm?function pop()
    if stackPointer= 0 then
    print ('error stack is empty')
    else
    print (stackPointer[StackPointer])
    stackPointer = stackPointer - 1
    endif
    endfunction

Informações

Descrição
A level Computer Science FlashCards sobre Stacks, criado por Ariana Parr em 19-09-2021.
Criado por
Ariana Parr
Visualizações
0
Avaliação

Fale Conosco

Sobre o que é sua mensagem?

O que você acha do novo visual?

Você gostou?