IB Diploma Programme (DP) - SL & HL · Computer Science

堆疊與佇列:練習題

3 條多項選擇題即時批改,另有 3 條文字題附完整解題步驟,全部圍繞「堆疊與佇列」。

6 條題目19 免費,無需登記
第 1 題
1

A Binary Search Tree (BST) is built by inserting values in the following order: 50, 30, 70, 20, 40, 60, 80. If the root node (50) is deleted and replaced by its in-order successor, which value will be the new root of the tree?

第 2 題
1

In the context of Abstract Data Structures, what is the primary role of a hash function when implemented in a hash table?

第 3 題
1

Consider a Circular Linked List where a single pointer, last, points to the final node in the list. What is the Big O time complexity for inserting a new node at the beginning (head) of the list?

第 4 題
3

Outline how a stack data structure is used by the system to manage sub-program calls and handle returns during program execution.

先自己寫一次答案,再對照解題步驟。

第 5 題
5

A singly linked list stores nodes where each node contains data and a pointer to the next node. A developer uses an external pointer, start, pointing to the first node.
Describe the algorithm steps required to delete a node that contains a specific target value from the middle of the linked list without causing memory disconnection.

先自己寫一次答案,再對照解題步驟。

第 6 題
8

A customer service system manages incoming support tickets using abstract data structures. Each ticket has a unique integer ID, and the system dynamically processes them using a single linked list and a binary search tree (BST).

(a) State one advantage and one disadvantage of using a dynamic data structure, such as a linked list, compared to a static data structure like an array for storing support tickets. [2]

(b) The following sequence of ticket IDs arrives and is inserted in this order into an initially empty Binary Search Tree (BST):
\(45, 23, 67, 12, 34, 56, 89, 78\)

(i) State the values visited during a pre-order traversal of the resulting tree. [2]
(ii) State the values visited during an in-order traversal of the resulting tree. [1]

(c) The linked list implementation uses nodes, where each node contains data and a reference next. The pointer head points to the first node in the list. The recursive sub-program countPriority(Node current, int threshold) counts the number of tickets whose ID is greater than threshold.

Construct the recursive algorithm in pseudocode for countPriority(Node current, int threshold). [3]

先自己寫一次答案,再對照解題步驟。

* thinka提供的內容由AI生成,可能並非總是準確或最新。請將其用作輔助資源,並與官方材料進行核實。

你已看過標準答案,接下來輪到批改你的答案。

這一頁可以告訴你好答案的樣子,卻無法指出你的答案欠缺什麼。thinka 按真實評分準則批改你的文字答案,約 15 秒完成。

想多做幾條同類題目?立即開始練習呢個課題,即做即批改。

立即練習