The operation for adding an entry to a stack is traditionally called:
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "push". Ngăn xếp là cấu trúc vào sau ra trước và chỉ cho tác động ở một đầu gọi là đỉnh, nên hai phép cơ bản của nó mang tên riêng: push đẩy một phần tử lên đỉnh và pop lấy phần tử ở đỉnh ra. Cặp tên này gắn với ngữ nghĩa đỉnh, nhờ vậy đọc mã là biết ngay cấu trúc đang dùng. "append" sai vì nó là từ của danh sách và chuỗi, nghĩa là nối thêm vào cuối, một vị trí mà ngăn xếp không nói tới. "insert" sai vì nó hàm ý chèn vào một vị trí bất kỳ, điều ngăn xếp cấm vì mọi thao tác chỉ xảy ra ở đỉnh. "add" sai vì đó là tên chung của các tập hợp, không cho biết phần tử mới đi vào đâu và lấy ra theo luật nào.
Cùng phần 2
Select the statement that is most correct.
Which of the following applications may not use a stack?Có lời giảiCâu hỏiConsider the following pseudocode:
declare a stack of characters
while(there are more characters in the word to read)
{read a character
if a character is '*' then
pop the stack
else
push the character into the stack
}
while(the stack is not empty)
pop and write the poped character to the screen
What is written to the screen for the input "Good**Morn**in***g" ?Có lời giảiCâu hỏiConsider the following pseudocode:
declare a stack of characters
while(there are more characters in the word to read)
{read a character
if a character is '*' then
pop and write the poped character to the screen
else
push the character into the stack
}
What is written to the screen for the input "Good**Morn**i***ng" ?Có lời giảiCâu hỏiCả 51 câu của chủ đề51 câu
Xuất hiện trong 1 bộ đề
Đi tiếp từ đây