電機題解

115 台北科技大學 資料結構 考古題解答

題目(共 24 題)

I-13 分

A stack follows the Last-In-First-Out (LIFO) principle.

購買後顯示這題的詳解
I-23 分

In a binary search tree, the left child of any node must be greater than its parent node.

購買後顯示這題的詳解
I-33 分

A queue can be efficiently implemented using two stacks.

購買後顯示這題的詳解
I-43 分

The time complexity of accessing an element in a hash table is always \(O(1)\) in the worst case.

購買後顯示這題的詳解
I-53 分

A complete binary tree with n nodes has a height of \(O(\log n)\).

購買後顯示這題的詳解
I-63 分

In a doubly linked list, each node contains pointers to both the next and previous nodes.

購買後顯示這題的詳解
I-73 分

A circular queue eliminates the problem of wasted space that occurs in a linear queue.

購買後顯示這題的詳解
I-83 分

Depth-first search (DFS) always finds the shortest path between two nodes in a graph.

購買後顯示這題的詳解
I-93 分

The maximum number of nodes in a binary tree of height \(h\) is \(2^{h+1}-1\).

購買後顯示這題的詳解
I-103 分

An AVL tree is a self-balancing binary search tree where the height difference between left and right subtrees of any node is at most 1.

購買後顯示這題的詳解
II-13 分

What is the time complexity of inserting an element at the beginning of a singly linked list?

a) \(O(1)\) b) \(O(n)\) c) \(O(\log n)\) d) \(O(n^2)\)

購買後顯示這題的詳解
II-23 分

Which data structure is most suitable for implementing a browser's back button functionality?

a) Queue b) Stack c) Binary Tree d) Hash Table

購買後顯示這題的詳解
II-33 分

In a max heap, where is the largest element located?

a) At a leaf node b) At the root node c) At the rightmost node d) At the deepest level

購買後顯示這題的詳解
II-43 分

In a B-tree of order m, what is the maximum number of children a non-root internal node can have?

a) \(m-1\) b) \(m\) c) \(m+1\) d) \(2m\)

購買後顯示這題的詳解
II-53 分

What is the worst-case time complexity of Dijkstra's algorithm for finding the shortest path in a graph with V vertices and E edges when implemented with a binary min-heap?

a) \(O(V)\) b) \(O(V+E)\) c) \(O((V+E)\log V)\) d) \(O(V^2)\)

購買後顯示這題的詳解
III-14 分

The evaluation of the prefix expression: / + * − * 5 3 7 2 10 + 4 2.

購買後顯示這題的詳解
III-24 分

Given a binary search tree with root 45, and the following nodes: 25, 65, 15, 35, 55, 75, 10, 20. Insert 18, 30, 50, 70 (in this order) into the binary search tree. What is the pre-order traversal?

購買後顯示這題的詳解
III-34 分

Let \(T(n)=3T\!\left(\frac n3\right)+n,\ T(1)=2\), then \(T(n)=O(b)\). What is b?

購買後顯示這題的詳解
III-44 分

In a hash table with 20 slots using linear probing, what is the worst-case number of comparisons needed to search for an element that is NOT in the table when the load factor is 0.75?

購買後顯示這題的詳解
III-54 分

Order the following functions by their growth rate from slowest to fastest: \(2^{\sqrt n},\ n^{1.5},\ \log(n!),\ \dfrac{n^2}{\log n},\ n\log^2n,\ 3^n,\ n^{\log n}\).

購買後顯示這題的詳解
IV-110 分

Consider a CPU task scheduler where processes are prioritized based on urgency:

Priority 1: Critical system tasks (highest priority)
Priority 2: Real-time applications
Priority 3: User applications
Priority 4: Background tasks (lowest priority)

Given the following task arrivals:

Task ATask BTask CTask DTask ETask FTask G
3142132

(a) Show the min-heap after all tasks have been added (lower priority number = higher urgency). (5 分)

(b) If 3 tasks are executed (removed from queue), show the order they are executed and the heap after each removal. (5 分)

購買後顯示這題的詳解
IV-210 分

Consider the following undirected graph:
Vertices: A, B, C, D, E, F
Edges: (A,B), (A,C), (B,D), (C,D), (C,E), (D,E), (D,F), (E,F)

(a) Draw the adjacency matrix representation of this graph. (5 分)

(b) Starting from vertex A, show the order of vertices visited using Breadth-First Search (BFS). Assume that when multiple vertices are available, they are visited in alphabetical order. (5 分)

購買後顯示這題的詳解
IV-310 分

Consider a hash table of size 11 using the hash function \(h(k)=k\%11\). Use linear probing to resolve collisions. Insert the following keys in order: 23, 45, 12, 67, 34, 78, 56, 89, 31.

(a) Show the final state of the hash table after all insertions. (5 分)

(b) How many collisions occurred during the insertion process? (5 分)

購買後顯示這題的詳解
IV-45 分

Given the following C++ function, what will this function return for abc##d. Explain your reasoning.

string processString(string input) {
    stack<char> S;
    string result = "";
    for(char c : input) {
        if(c == '#') { if(!S.empty()) S.pop(); }
        else { S.push(c); }
    }
    while(!S.empty()) { result = S.top() + result; S.pop(); }
    return result;
}
購買後顯示這題的詳解

北科資料結構其他年度

114113112

115 學年度北科其他科目

工程數學線性代數

北科電機所全部考古題 →