原创 代碼片段和聲明標識的區別

<%%> 代碼片段的語法格式:<% Java代碼或是腳本代碼 %> <%!%> 聲明標識的語法格式:<%! 聲明變量或方法的代碼 %> 區別:通過聲明標識創建的變量和方法在當前JSP頁面中有效,它的生命週期是從創建開始到服務器關閉結束;代

原创 7-5 Tree Traversals Again (25 分)

An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when

原创 7-1 Maximum Subsequence Sum (25 分)

Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​

原创 LeetCode547. 朋友圈 並查集

班上有 N 名學生。其中有些人是朋友,有些則不是。他們的友誼具有是傳遞性。如果已知 A 是 B 的朋友,B 是 C 的朋友,那麼我們可以認爲 A 也是 C 的朋友。所謂的朋友圈,是指所有朋友的集合。 給定一個 N * N 的矩陣 M,表示

原创 數據庫回顧

CREATE DATABASE kcdb ON PRIMARY (NAME = 'kcdb_data', FILENAME = '\\vmware-host\Shared Folders\桌面\kcdb_data.mdf', SIZE

原创 6-3 鄰接表存儲圖的廣度優先遍歷 (20 分)

試實現鄰接表存儲圖的廣度優先遍歷。 函數接口定義: void BFS ( LGraph Graph, Vertex S, void (*Visit)(Vertex) ); 其中LGraph是鄰接表存儲的圖,定義如下: /* 鄰接點的

原创 6-2 圖的深度遍歷-鄰接表實現 (10 分)

本題要求實現鄰接表存儲圖的深度優先遍歷。 函數接口定義: void DFS(ALGraph *G,int i); 其中ALGraph是鄰接表存儲的圖,定義如下: #define MAX_VERTEX_NUM 10 /*定

原创 6-1 鄰接矩陣存儲圖的深度優先遍歷 (20 分)

試實現鄰接矩陣存儲圖的深度優先遍歷。 函數接口定義: void DFS( MGraph Graph, Vertex V, void (*Visit)(Vertex) ); 其中MGraph是鄰接矩陣存儲的圖,定義如下: typede

原创 7-2 Insert or Merge (25 分)

According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted outp

原创 7-12 搶紅包 (25 分)

沒有人沒搶過紅包吧…… 這裏給出N個人之間互相發紅包、搶紅包的記錄,請你統計一下他們搶紅包的收穫。 輸入格式: 輸入第一行給出一個正整數N(≤10​4​​),即參與發紅包和搶紅包的總人數,則這些人從1到N編號。隨後N行,第i行給出編號爲i

原创 7-10 PAT排名彙總 (25 分)

計算機程序設計能力考試(Programming Ability Test,簡稱PAT)旨在通過統一組織的在線考試及自動評測方法客觀地評判考生的算法設計與程序設計實現能力,科學的評價計算機程序設計人才,爲企業選拔人才提供參考標準(網址htt

原创 6-2 Iterative Mergesort (25 分)

How would you implement mergesort without using recursion? The idea of iterative mergesort is to start from N sorted su

原创 6-2 LCA in BST (25 分)

The lowest common ancestor (LCA) of two nodes u and v in a tree T is the deepest node that has both u and v as descenda

原创 6-5 No Greater Than X in BST (20 分)

6-5 No Greater Than X in BST (20 分) You are supposed to output, in decreasing order, all the elements no greater than X

原创 6-3 AVL Insertion (30 分)

You are supposed to implement the Insert function, which inserts an integer Key into an AVL tree T. The resulting tree