B-tree job writing, writing C++b-tree programming jobs
Developed by Jerry Cain of Stanford University and adapted by Jingling Xue.
We ' ve learned that C + + considers the preservation of type information to being much more
Impor-tant than C ever does. With that understanding, C + + ' s support for generic containers and
Algorithms is much more sophisticated, and you should practise writing template containers in
C++-afterwards, you'll be on a better position to compare and contrast the both languages,
Because you'll have written serious, INDUSTRIAL-STRENGTH data structures in C + +. In general, it ' s
Hard-to-write quality generic code no matter what language you ' re using!
1. Aims
In this assignment you'll get a chance to implement a reasonably complex, generic
C + + container, together with proper iterators. You'll practice working with template
Classes and everything this entails. You'll write a bi-directional iterator from scratch,
Use iterator adaptors to provide reverse iterators. You'll also employ lots of the C + +
Features you has learnt about in this course. You'll also has a second chance to
Practice working move semantics if you didn ' t get it right in assignment 3.
2. The B-tree Container
B-trees is generalised binary search Trees, where a Binary-search-tree-like property is
Maintained throughout the entire structure. The primary Difference-and it ' s a big
One-is that each node of the tree have many children, from a handful to thousands.
Actually, it's the number of the client elements stored within the node that determines the
Number of children. In the same to that a single element partitions a binary search tree
Into Sub-trees, a
B-tree node storing four
Clients elements
Partitions the B-tree into
Five sub-b-trees. If the
Four elements is stored
In sorted order, it ' s very
Easy to constrain
Type of elements can
Reside in each of the five
Sub-b-trees.
Check out the B-tree node
We ' ve drawn on the next
Page. Note that C, J, S, and W
Split the rest of the B-tree
into sub-b-trees that store elements A through B, D through I, K through R, T through
V, and X through Z. This B-tree property is maintained throughout the entire structure.
Think of each node as a mother with quintuplets instead of twins.
The above picture implies that the stored elements is characters, but any element
Capable of comparing itself to others can is stored in a b-tree. And the decision to store
Four keys per node is really arbitrary. While all nodes would store the same number of
Elements (except along the fringe-sometimes there just aren ' t enough elements to fill up
The fringe of the B-tree), the actual node size can be tweaked to maximise performance.
In practice, the number is typically even, and are chosen so, the total amount of
Memory devoted to one node was as close to a memory page size as possible. That's the, all
Of your elements is likely to being right next to each other in memory, and the operating
System maximises the number of elements in the cache at any one time.
We ' re not going to burden you with those optimisations though. Your task is to
Implement a generic b-tree template capable of storing any type whatsoever. Here ' s A
Very brief look at the template interface. You'll need to provide implementations for the
Constructor and destructor, the insert operation, the both versions of Find (which are
Precisely the same, save the const versus Non-const business), and the output
operator <<?. You'll also need to provide full, explicit copy control using value
Semantics, i.e., no shared pointees.
Template <typename t>
Class Btree {
Public
Btree (size_t maxnodeelems = 40);
Btree (const btree<t>&);
Btree (btree<t>&&);
btree<t>& operator= (const btree<t>&);
btree<t>& operator= (btree<t>&&);
Friend ostream& operator<< <> (ostream&, const btree<t>&);
typedef ' s for iterators and declarations
For Begin (), End (), Rbegin (), Rend () and
Cbegin (), Cend (), Crbegin () and crend () go here
Iterator find (const t&);
Const_iterator Find (const t&) const;
Pair<iterator, bool> Insert (const t&);
Make sure your destructor does not leak memory
(If raw pointers is used)
~btree ();
Private
Your internal representation goes here
};
The btree.h header file tells you everything your need to know on what ' re
Implementing and what are you aren ' t. You must implement "s outlined above, and in
Doing so, your should write clean, compact C + + code you ' d is proud to show mum
And dad.
3.?? Implementation?? Details
3.1?? Internal?? Representation
Choose whatever suitable STL container to represent a b-tree node. As
For the pointers linking a node with its child nodes and parent node, you can either use
Raw pointers or smart pointers. This is completely. However, either raw
Pointers or smarter pointers must be used. Failure to doing so would result in a final mark of 0 for
This deliverable.
3.2?? Insertion
Remember that's required to balance the b-tree.
We ' re leaving the details of the concrete representation up to you, but the details of
Insertion is complicated enough that you deserve a few illustrations. Once you have
Insertion down, search was more or less straightforward.
For the purposes of illustration assume that nodes is engineered to store up to four
Characters. Initially, a b-tree is empty, but after inserting and elements, the state of the
Tree would look as follows:
Because there is only a elements in the tree and we needn ' t give birth to any child nodes.
In fact, it won ' t is until we saturate the root node above with both more elements before
The addition of new elements would mandate the allocation of a child.
To insert the letter P at the would require that the X is shifted over to make the.
The node is designed-store a total of four elements, so the P really belongs in between
The M and the X:
Throw in a G for good measure, and voilà, which you had a saturated node of size four:
At this point, the node was structured this lifetime of the B-tree. But now that
It's completely full, it'll need to give birth to child nodes as needed.
Consider now the insertion of the letter T. Since five ' s a crowd, a new node-one capable
of storing all types of characters ranging from Q through W-is allocated, and a pointer
To this node is recorded as being ' in between ' elements P and X of the root:
Curious how is the tree grows after we insert a B, a Z, an N, and then an R? Check out the
Following film in slow motion:
Note that each of the new nodes is allocated because the first element inserted into it
was required to reside there. T had to go in the node stemming between P and X because
Anything alphabetically in between P and X needs to be placed there. B is inserted before
G, Z after X and N between M and P. Finally R is T ' s sibling.
As more and more characters is inserted, it's likely that even the child nodes'll
Saturate, and when this happens, each of the children starts its own family. Consider the
Insertion of S and W into the Frame-5 b-tree above. R and T allow S and W to join
them:
The insertion of Q and V at this point would require the introduction of Third-level
Nodes, as with:
In theory, there's no limit whatsoever to how deep the tree can get. At the risk of
Repea-ting ourselves and seeming monotonous, let us say some important things again:
The tree above stored four elements per node, but b-trees can store
prede-fined Maximum. The default value of the constructor argument implies
Should store a default of elements per node. Of course, the code you write should
Work for any value greater than 0.
The tree above stored characters, but the b-tree are templated, so we could has just as
Readily used a b-tree of strings or doubles or records. Of course, the code you write
Shouldn ' t is character-specific, but the general enough to store any type whatsoever. That ' s
where templates come in.
The underlying implementation of the B-tree are for you and decide, but the
Implemen-tation certainly must make use of a multiply-linked structure
Drawings above. Failure to does so are likely to result in a nice, round mark for this
Deliverable (0!). How does your store the client elements and the child nodes? That ' s your
Job.
The Insert function returns a pair is a class template provided in the C + + STL. The
First element in the pair is a iterator positioned at the element inserted. The second
Element is a Boolean value indicating whether the insertion are successful or not. The
Second element is false if the element to being inserted is found already in the B-tree and
True otherwise.
3.3?? Searching
The Find function returns an iterator positioned at the element found in the B-tree. If
The element being searched is not a found in the B-tree, a iterator that's equal to the
return value of End ()? is returned.
3.4?? Copy?? Control
All Copy-control members must is implemented correctly. The move constructor and
Move-assignment operators is implemented in a few lines each. For a Moved-from
Btree object, you should know by now what to put it in a state correctly according to the
C++14 requirement. For this assignment, a moved-fromm b-tree should is empty.
3.5?? Iterators
Required to implement a bonafide bi-directional iterator type capable of doing
An inorder walk of the B-tree. An inoder traversal would allow all values in a b-tree to be
Printed in the increasing order of their values, where the comparison operator is defined
By the type of the elements in the B-tree. Since The iterators is bi-directional they would
Also support the reverse inorder traversal. You must implement your iterators as an
External class (Btree_iterator?), failure to does so would result in a final mark of 0 for this
Deliverable.
The iterators would come in const and Non-const forms, just as they would for any
Built-in STL container. The iterators should respond to the *?,-;?, + +?,--?, = = and! =
Operators and be able to march over and access all of the sorted elements in sequence,
From 1 to 32767, from ' Aadvark ' to ' zygote ', etc., as well as support backward
Move-ment. The challenge is working off how to ++/--behave when a neighboring
Element resides in another part of the B-tree.
Your iterators should be appropriately declared as bi-directional. You should implement
and test the complete bi-directional iterator functionality. This includes pre/post
Incre-ment and decrement. The post-increment/decrement operations should return a
Copy of the value pointed to before the increment/decrement is performed.
It can be argued that the Non-const iterators to a b-tree is dangerous, since changing
The values of elements are likely to break the B-tree invariant. This was indeed the case, but
You still has to implement this feature to develop some practical experience and we
Would assume the responsibility. Your Non-const iterator'll be tested, e.g., increment
Every value in the B-tree by one. It is important so you get to practice writing a
Non-const? Iterator.
In addition, you is to implement const and Non-const forms of reverse iterators.
These reverse iterators should be returned by the Rbegin () and rend () b-tree
Mem-ber functions. You should use iterator adaptors to implement your reverse
Iterators. Once you has managed to make the const and Non-const forms of the "forward"
Iterators work for your, it takes usually a few extra minutes to implement the reverse iterators by
Using iterator adaptors.
You can now implement the C++14 begin and end member functions, Cbegin (), Cend (),
Crbegin ()? and Crend (). ? This can is done with a few minutes by implementing them in terms of the
member functions that there are already implemented for the "forward" and reverse iterator.
3.6?? Output?? Operator
Implement the output operator for the B-tree class. This operator should just
Print the values of the nodes in the B-tree at Breadth-first (level) order. The values
Should is separated by spaces. No NewLine is-to-be output. For example, the output
Operator would print the following when called on the last version of the tree in 3.1:
G M P X B N R S T W Z Q V
Assume that the types stored in your b-tree themselves support the output
operator. Note that we'll use the output operator in combination with the iterator
Traversal to ensure this your B-tree structure is above-board correct. This means
Must construct your b-tree exactly as indicated, any other approach, including any
Balancing scheme, is likely to leads to failed tests.
4. Testing the B-tree
We ' ve provided a simple C + + program that ' ll exercise your b-tree just enough to start
Believing in it passes. It's hardly exhaustive, as it is only builds b-trees of integers.
It does, however, do a good job of confirming, then find and insert do their jobs, and it
Does an even better job of showing what quickly b-trees support the insertion of
Roughly 5,000,000 random integers in less than seconds. Try that with a hash table or a
Binary search tree and you'll see it flail in comparison. This was cool and you should think
So Too! exciting!
Apart from the This test program, a couple of and simple tests is provided.
You were responsible for making sure your b-tree was bullet proof, and if some bug in your
Code isn ' t flagged by we tests, that's still your crisis and not ours. You should try
Buil-ding your own test programs to make sure this everything checks out okay when
You store doubles, strings, and structures. A great opportunity to try some unit
testing, because the class you ' re testing is very small and easily stressed.
Your code would be compiled together with a test file containing the main function and
With these compiler flags:
% g++-wall-werror-o2–std=c++14-fsanitize=address ...
No matter where do your development work, when done, is sure your deliverable works on
The school machines.
5. Getting Started
You is provided with a stubs that contains the files you need to get started on this
Deliverable. The stub is available on the subject account. Login to CSE and then type
Something like this:
% mkdir-p Cs6771/btree
% CP ~cs6771/soft/17s2/btree.zip.
% Unzip Btree.zip
% ls
% more README
In the stub, should find a fully documented btree.h file, a btree_iterator.h
Stub file, and some test files designed to exercise the b-tree and make sure it ' s working.
You'll see a Makefile? In the mix as well.
Introduce any new classes you like, e.g., a node class. To make marking
Easier classes in the submission files. Take the time-to-do-thing right,
Since it ' s really at the heart of what C + + generics is all about.
You should want-do
These things the right.
Allowed to the names of the Btree/btree_iterator classes.
Neither can interface of the Btree class template as defined in
Btree.h?, of course, you'll agument it with the appropriate iterator related types and
Operations.
Please note that the supplied files don ' t yet compile since there are no definition for some
of the files.
Our implementation with generous comments consists of about + lines of C + + code.
6. Marking
This deliverable is worth 10%? of your final mark.
Your submission'll is given a mark out of the with a 80/100 automarked component
For output correctness and a 20/100 manually marked component for code style and
Quality.
As always, failure to implement a proper b-tree representation and/or an external,
Iterator class, would earn you a total mark of 0 for this deliverable.
As this was a third-year course we expect that your code would be the well formatted,
Docu-mented and structured. We also expect that you'll use the standard formatting and
Naming conventions. However, the style marks would be awarded for writing C + + code
Rather than C code.
As for the performance of your solution, we is lenient. When compared to a
Straightforward implementation,?? Your????????????????????????????????? expected.
7. Submission
Copy your code to your CSE account and make sure it compiles without any errors or
Warnings. Then run your test cases. If all are well then submit using the command (from
Within your Del4 directory):
% give cs6771 ass4 btree.h btree_iterator.h
Note that your is to submit specific files-means that these is the only files you
should modify. You should also ensure they work within the supplied infrastructure.
If you submit and later decide to submit a even better version, go ahead and submit
A
Second (or third, or seventh) time; We'll only have mark the last one. Be sure to give yourself
More than enough time before the deadline to submit.
Late submissions would be penalised unless you had legitimate reasons to convince the
LIC otherwise. Any submission after the due date would attract a reduction of 20% per day
To the maximum mark. A day was defined as a 24-hour day and includes weekends and
Holidays. Precisely, a submission x hours after the due date was considered to be ceil (X/24)
Days late. No submissions would be accepted more than five days after the due date.
Plagiarism constitutes serious academic misconduct and won't is tolerated.
Further details about lateness and plagiarism can is found in the Course Outline.
Http://www.daixie0.com/contents/13/1241.html
The core staff of the team mainly include Silicon Valley engineers, bat front-line engineers, domestic TOP5 master, PhD students, proficient in German English! Our main business scope is to do programming big homework, curriculum design and so on.
Our Direction field: Window Programming numerical algorithm AI Artificial Intelligence financial statistical Metrology analysis Big Data network programming Web programming Communication Programming game Programming Multimedia Linux plug-in programming API image processing embedded/Microcontroller database programming console process and thread Network security assembly language Hardware programming software Design Engineering Standard Rules. The generation of programming languages or tools including, but not limited to, the following ranges:
C/c++/c# Write
Java Write generation
It generation
Python writes
Tutoring Programming Jobs
The MATLAB Generation writes
Haskell writes
Processing Write
Linux Environment Setup
Rust Generation Write
Data Structure assginment Data structure generation
MIPS Generation Writing
Machine Learning Job Writing
Oracle/sql/postgresql/pig database Generation/Generation/Coaching
Web development, Web development, Web site jobs
Asp. NET Web site development
Finance insurace Statistics Statistics, regression, iteration
Prolog write
Computer Computational Method Generation
Because of professional, so trustworthy. If necessary, please add qq:99515681 or e-mail:[email protected]
: Codinghelp
B-tree job generation, write C++b-tree programming jobs, C + + programming to do to help do paid generation do