樣板 B 樹 ( B - tree )
規則 :
(1) 每個節點內元素個數在 [MIN,2*MIN] 之間, 但根節點元素個數為 [1,2*MIN]
(2) 節點內元素由小排到大, 元素不重複
(3) 每個節點內的指標個數為元素個數加一
(4) 第 i 個指標所指向的子節點內的所有元素值皆小於父節點的第 i 個元素
(5) B 樹內的所有末端節點深度一樣
給定兩個集合A、B,集合內的任一元素x滿足1 ≤ x ≤ 109,并且每個集合的元素個數不大于105。我們希望求出A、B之間的關系。
任 務 :給定兩個集合的描述,判斷它們滿足下列關系的哪一種:
A是B的一個真子集,輸出“A is a proper subset of B”
B是A的一個真子集,輸出“B is a proper subset of A”
A和B是同一個集合,輸出“A equals B”
A和B的交集為空,輸出“A and B are disjoint”
上述情況都不是,輸出“I m confused!”
Implemented BFS, DFS and A*
To compile this project, use the following command:
g++ -o search main.cpp
Then you can run it:
./search
The input is loaded from a input file in.txt
Here is the format of the input file:
The first line of the input file shoud contain two chars indicate the source and destination city for breadth first and depth first algorithm.
The second line of input file shoud be an integer m indicate the number of connections for the map.
Following m lines describe the map, each line represents to one connection in this form: dist city1 city2, which means there is a connection between city1 and city2 with the distance dist.
The following input are for A*
The following line contains two chars indicate the source and destination city for A* algorithm.
Then there is an integer h indicate the number of heuristic.
The following h lines is in the form: city dist which means the straight-line distance from the city to B is dist.