代写COMP4035语言、B+-Tree编程代写、代做C++,Java程序语言代写Python程序|代写留学生Prolog

COMP4035 Database System Implementation Project Assignment
Project Assignment – Implementing B+-Tree
Due: 11:59pm Dec 5, 2020
 Students are required to work in groups of 2-4 members. Students are responsible to
form groups among themselves.
 Each group should have a group leader. by Oct 23, 2020. Those who fail to register their groups by
the deadline will be grouped by random by the instructor.
 Start early and proceed in steps. Read the project description carefully before you start.
 This assignment is worth 10% of your overall grade.
Project Description
In this assignment, you will implement a B+-tree index:
Assume the whole B+-tree is kept in the main memory.
Assume the fan-out of each node is 5 (i.e., 4 index/data entries per page).
Assume Alternative 2 is used for data entries.
 For simplicity, we only handle integer search keys; we don’t maintain actual data
records (so the rids in data entries can be set to null).
Your implementation should also deal with duplicate key values (refer to Page 357 in
the (3rd edition) textbook).
You can use any language (e.g., C, Java, C++, C#, etc.) for the implementation.
Group Members
You are required to work in groups of 2-4 members.
4-member groups, 3-member groups, and 2-member groups will be graded in the same.
Under special circumstances, students may form groups of a single student, but prior
approval from the instructor is required. 5-member groups are not allowed.
Each member of the same group will receive the same mark, so you need to distribute
the work among yourselves evenly. Under exceptional cases, if the members of the same
group wish to receive different grades, you should attach one separate page in the
documentation, justifying the reason and identifying individual contributions (in
percentage).
Assignment Requirements
In this assignment, you are required to implement a class, BTree, link it with the main test
program, and make sure that all test programs run successfully. Note that a successful run does
not mean that your program is correct. You should also ensure that your program will work for
all possible test cases.
COMP4035 Database System Implementation Project Assignment
The details of the functions that you have to implement are given below. We have also provided
some sample code that illustrates the use of the class BTree. However, these samples are
extremely simple and do not reflect the actual coding that we expect from you. For example,
we do not show any error checking in these samples. You are expected to write robust programs
by signaling errors when necessary.
BTree::BTree
The constructor for the BTree takes in a filename, and checks if a file with that name already
exists. If the file exists, we "open" the file and build an initial B+-tree based on the key values
in the file. Otherwise, we return an error message and the program terminates.
BTree::~BTree
The destructor of BTree just "closes" the index. This includes de-allocating the memory space
for the index. Note that it does not delete the file.
BTree::Insert
This method inserts a pair (key, rid) into the B+-Tree Index (rid can always be assumed to be
0 in your implementation). The actual pair (key, rid) is inserted into a leaf node. But this
insertion may cause one or more (key, pid) pair to be inserted into index nodes. You should
always check to see if the current node has enough space before you insert. If you don't have
enough space, you have to split the current node by creating a new node, and copy some of the
data over from the current node to the new node.1 Splitting will cause a new entry to be added
in the parent node.
Splitting of the root node should be considered separately, since if we have a new root, we need
to update the root pointer to reflect the changes. Splitting of a leaf node should also be
considered separately since the leaf nodes are linked as a link list.
Due to the complexity of this function, we recommend that you write separate functions for
different cases. For example, it is a good idea to write a function to insert into a leaf node, and
a function to insert into an index node.
BTree::Delete
This method deletes an entry (key, rid) from a leaf node. Deletion from a leaf node may cause
one or more entries in the index node to be deleted. You should always check if a node
underflows (less than 50% full) after deletion. If a node becomes underflows, merging or
redistribution will occur (read and implement the algorithm in the notes).
You should consider different scenarios separately (maybe write separate functions for them).
You should consider deletion from a leaf node and index node separately. Deletion from the
root should also be considered separately.
The following code fragment may be helpful:
1 Assume the re-distribution option is NOT used.
COMP4035 Database System Implementation Project Assignment
Checking if a node is half full:
if (node->AvailableEntries() < (Fanout-1)/2)
{
// Try to re-distribute, borrowing from sibling
// (adjacent node with same parent as this node).
// If re-distribution fails, merge this node and sibling.
}
BTree::Search
This method implements range queries. Given a search range (key1, key2), the method returns
all the qualifying key values in the range of between key1 and key2 in the B+-tree. If such keys
are not found, it returns “none”. Be careful with the duplicate keys that span over multiple
pages.
BTree::DumpStatistics
In this method, you are required to collect statistics to reflect the performance of your B+-
Tree implementation. This method should print out the following statistics of your B+-Tree.
1. Total number of nodes in the tree
2. Total number of data entries in the tree
3. Total number of index entries in the tree
4. Average fill factor (used space/total space) of the nodes.
5. Height of tree
These statistics should serve you in making sure that your code executes correctly. For
example, the fill factor of each node should be greater than 0.5. You should make sure that
DumpStatistics performs this operation.
BTree::PrintTree, BTree::PrintNode
These are helper functions that should help you debug, by showing the tree contents.
PrintTree must be implemented and PrintNode is optional.
User Interface
You should run the program interactively. The program should take one argument, which
specifies the data file storing the search key values on which the initial B+-tree is built. After
you launch the program, the program will wait for commands on stdin. An example interface
is given below (the bold lines are your input, while the others are the output of your program):
> btree -help
Usage: btree [fname]
fname: the name of the data file storing the search key values
> btree data.txt
Building an initial B+-Tree...
Launching B+-Tree test program…
COMP4035 Database System Implementation Project Assignment
Waiting for your commands:
insert 10 20 2
2 data entries with keys randomly chosen between [10, 20] are inserted!
delete 15 16
The data entries for values in [15, 16] are deleted.
print
print out your B+-tree here; the format is up to you as long as it’s clear …
stats
Statistics of the B+-tree:
Total number of nodes: 9
Total number of data entries: 20
Total number of index entries: 3
Average fill factor: 60%
Height of tree: 3
quit
Thanks!Byebye
>
The data file containing the search key values has the format of one value per line. An
example data file is:
13
2
16
14
10
13
16
7
Below are the commands your program should support:
insert Insert num records randomly chosen in the range [low, high]
delete Delete records with key values in the range [low, high]
search Return the keys that fall in the range [low, high]
print Print the whole B+ tree (format up to you, but be clear!)
stats Show stats
quit Terminate the program
Submission Procedure
COMP4035 Database System Implementation Project Assignment
1) Zip the entire set of source code, together with a report, and make files if any, and upload
it to BUMoodle. Further details will be provided later.
2) The report should describe (expected to be 2-5 pages long):
 Brief description of this project and the B+-tree
 The data structures used in the implementation
 Algorithms used
 The platform (Windows or Unix), the usage of your program, and the installation
procedure if needed
 Highlight of features, if any, beyond the required specification
Grading Criteria
 Correctness (70%): You will get full marks if your implementation is correct. Partial
credit will be given to a partially correct submission.
 Coding Style (10%): We expect you to write neat code. Code should be nicely
indented and commented. We also expect you to follow the coding conventions.
 Documentation (20%): The report should be short, clear, concise, and informative
(see the guidelines above).
Coding Conventions
You need to follow certain coding conventions for all your assignments.
 Name for all classes/methods/types should start with a capital letter. Break multiple
words with caps. For example InsertLeafEntry.
 Name for all members/variables should start with small letters. Break multiple words
with caps. For example numOfNodes;
 Name for all enum/macro should be all caps. Break multiple words with underscore.
For example NODE_FANOUT.
VERY IMPORTANT Advice
 Start early.
 Do this assignment in increasingly more difficult steps. For example, you might want
to implement BTree::Insert and for tree with only one node (a root) and assume no
overflow. Then implement BTree::Insert that handles overflows in leaf nodes, and then
implement BTree::Insert to handle overflows in index nodes.
 The project must be done by the individual group. No sharing of code and copying of
code from others are allowed. Once detected, all the involved will be given some penalty
in the final grade in addition to zero mark to the project.

热门主题

课程名

mktg2509 csci 2600 38170 lng302 csse3010 phas3226 77938 arch1162 engn4536/engn6536 acx5903 comp151101 phl245 cse12 comp9312 stat3016/6016 phas0038 comp2140 6qqmb312 xjco3011 rest0005 ematm0051 5qqmn219 lubs5062m eee8155 cege0100 eap033 artd1109 mat246 etc3430 ecmm462 mis102 inft6800 ddes9903 comp6521 comp9517 comp3331/9331 comp4337 comp6008 comp9414 bu.231.790.81 man00150m csb352h math1041 eengm4100 isys1002 08 6057cem mktg3504 mthm036 mtrx1701 mth3241 eeee3086 cmp-7038b cmp-7000a ints4010 econ2151 infs5710 fins5516 fin3309 fins5510 gsoe9340 math2007 math2036 soee5010 mark3088 infs3605 elec9714 comp2271 ma214 comp2211 infs3604 600426 sit254 acct3091 bbt405 msin0116 com107/com113 mark5826 sit120 comp9021 eco2101 eeen40700 cs253 ece3114 ecmm447 chns3000 math377 itd102 comp9444 comp(2041|9044) econ0060 econ7230 mgt001371 ecs-323 cs6250 mgdi60012 mdia2012 comm221001 comm5000 ma1008 engl642 econ241 com333 math367 mis201 nbs-7041x meek16104 econ2003 comm1190 mbas902 comp-1027 dpst1091 comp7315 eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 comp3425 comp9417 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst litr1-uc6201.200 ee1102 cosc2803 math39512 omp9727 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 07 cisc102 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 math21112 efim20036 mn-3503 fins5568 110.807 bcpm000028 info6030 bma0092 bcpm0054 math20212 ce335 cs365 cenv6141 ftec5580 math2010 ec3450 comm1170 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 math350-real math2014 eec180 stat141b econ2101 msinm014/msing014/msing014b fit2004 comp643 bu1002 cm2030
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图