原创 PAT甲級1142 Maximal Clique (25分) 英文閱讀........
1142 Maximal Clique (25分) A clique is a subset of vertices of an undirected graph such that every two distinct vert
原创 PAT甲級1095 Cars on Campus (30分) 繁瑣
1095 Cars on Campus (30分) Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the
原创 PAT甲級1127 ZigZagging on a Tree (30分) 中序 後序構造二叉樹,之前就寫錯過,這次又寫錯了。。。。*******
1127 ZigZagging on a Tree (30分) Suppose that all the keys in a binary tree are distinct positive integers. A unique
原创 PAT甲級1133 Splitting A Linked List (25分) 簡單題 ,list刪除
1133 Splitting A Linked List (25分) Given a singly linked list, you are supposed to rearrange its elements so that a
原创 PAT甲級1103 Integer Factorization (30分) ***** 有難度 測試點2分析, 遞歸寫的再規範點
題目倒是好讀懂,關鍵是如何構建這個等式,我沒想到太好的辦法,就是準備用深搜試試,題目給出的N最大也就400,最初感覺良好,結果還是爲了時間優化了好久,另外這題可以好好整理下遞歸深搜的標準寫法。 先說測試點2吧,這個測試點的情
原创 PAT甲級1144 The Missing Number (20分) 簡單題
1144 The Missing Number (20分) Given N integers, you are supposed to find the smallest positive integer that is NOT
原创 PAT甲級1138 Postorder Traversal (25分) 前序 中序 轉換後序
1138 Postorder Traversal (25分) Suppose that all the keys in a binary tree are distinct positive integers. Given the
原创 PAT甲級1150 Travelling Salesman Problem (25分) 模擬的簡單題
1150 Travelling Salesman Problem (25分) The “travelling salesman problem” asks the following question: “Given a list
原创 PAT甲級1051 Pop Sequence (25分) 判斷數列是否能用棧輸出,蠻有意思,東大初試好像就有這題
1051 Pop Sequence (25分) Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …,
原创 PAT甲級1050 String Subtraction (20分) 簡單題
Subtraction (20分) Given two strings S 1 and S 2 , S=S 1 −S 2 is defined to be the remaining strin
原创 PAT甲級1079 Total Sales of Supply Chain (25分) 層序遍歷
1079 Total Sales of Supply Chain (25分) A supply chain is a network of retailers(零售商), distributors(經銷商), and suppli
原创 PAT甲級1098 Insertion or Heap Sort (25分) 堆排序 swap交換數組元素
1098 Insertion or Heap Sort (25分) According to Wikipedia: Insertion sort iterates, consuming one input element each
原创 PAT甲級Invert a Binary Tree 柳神層序遍歷的思路值得借鑑
1102 Invert a Binary Tree (25分) The following is from Max Howell @twitter: Google: 90% of our engineers use the sof
原创 PAT甲級1090 Highest Price in Supply Chain (25分) 雙vector來記錄圖 隊列實現廣搜
1090 Highest Price in Supply Chain (25分) A supply chain is a network of retailers(零售商), distributors(經銷商), and supp
原创 PAT甲級1058 A+B in Hogwarts (20分) 自己實現加法的好的思路,別使用進位變量了,麻煩的很
1058 A+B in Hogwarts (20分) If you are a fan of Harry Potter, you would know the world of magic has its own currency