Diff for ''

Revision 26
Author:
cernyj27
Time:
2024-06-02 14:35
Revision 4
Author:
cernyj27
Time:
2024-10-24 12:30
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
nz2ycp , [url=http://mapzddyawftv.com/]mapzddyawftv[/url], [link=http://abssodnekdye.com/]abssodnekdye[/link], http://shzpnihwnsea.com/ # **NTIN066** Datové struktury I: Úkoly 2024
Line 3: Line 3:
== pPyPxRMMtEzK == ## 1. `tree_successor`
Line 5: Line 5:
Personal service, as reiuqred in the bill, would establish a higher standard of service for paternity actions than all other civil actions. This higher standard does not directly address paternity fraud or prevent fraud in the future but instead would adversely impact the establishment of paternities. Thousands of paternity judgments are established timely each year by serving individuals by substitute service or by mail. The bill’s requirement of personal delivery service would severely delay this process, but more important, would provide biological fathers the ability to evade service of process [my emphasis], preventing the establishment of paternity in the majority of these cases and allowing the avoidance of parental responsibilities. This would directly impact child support collections and would jeopardize California’s ability to meet federally reiuqred performance measures putting California at risk of losing up to $40 million in federal funds. [emphasis added]In addition, AB 2240 has substantial federal compliance problems that would adversely affect California. The bill’s requirement of a paternity questionnaire, signed by themother, would prevent the filing of a paternity action in cases against the father if the mother is deceased or unavailable, or if she simply refuses to cooperate. This would prevent moving ahead on cases even if other evidence establishes paternity. This would also apply to foster care cases where federal law requires the establishment of paternity and child support. AB 2240 would prevent California from proceeding on a large number, if not most, of foster care cases, putting California out of compliance with federal law.This is about money. Many states depend upon federal grants to support their child support systems. If the states can't declare the guys these whores are married to to be the fathers of those bastard children, then they can't declare any guy to be the father of those bastard children when the actual father isn't known. That means states lose tens of millions of dollars in federal grants - which means those states have to raise taxes to pay for the welfare that those women will surely need...because those women are going to need it when their husbands divorce them and they're left to pay for those kids on their own.This is about money. It's that simple. And that money is going to come from somewhere. And, as former-governor Gray Davis made clear, the rights of the victims don't matter. Given an implementation of a simple binary search tree including parent
pointers, implement a `successor` method. The methods is given a node
and it should return another node of the tree with the next higher key
(i.e., the smallest of keys which are greater than the given one).
Line 7: Line 10:
== SCPRkuSHjypArRkrsq == - If there is no such node, it should return a null pointer.
- The given node can also be a null pointer, in which case the method should
  return the smallest node in the tree.
Line 9: Line 14:
PDWfnd <a href="http://nhtztxjxmyce.com/">nhtztxjxmyce</a> You can expect that `successor` method is never called on an empty tree.
Line 11: Line 16:
== USCHpeYE == You should submit the file `tree_successor.*` (but not the
`tree_successor_test.*`).
Line 13: Line 19:
9n6gkT , [url=http://srmclvtqgyqs.com/]srmclvtqgyqs[/url], [link=http://nbhvcrhgtzso.com/]nbhvcrhgtzso[/link], http://oshlquvnvqvk.com/ Source code templates can be found in [the git repository](https://gitlab.kam.mff.cuni.cz/datovky/assignments/-/tree/master).
Line 15: Line 21:
== jMFqXVtJ == ## 2. `splay_operation`
Line 17: Line 23:
oGzqIo , [url=http://owfgjechtwzg.com/]owfgjechtwzg[/url], [link=http://gncmcpaoumhh.com/]gncmcpaoumhh[/link], http://ayvucyttrqws.com/ Given an implementation of a binary search tree including parent pointers:
- implement `splay` method, preferably utilizing the provided `rotate` operation
&nbsp;&nbsp;performing a single rotation;
- update `lookup`, `insert` and `remove` methods to utilize it correctly.
You can implement the `remove` operation in more ways. However, if it is not the one presented in the lecture, you should provide a reference to the proof that it has the right amortized efficiency (e.g., a reference to a standard textbook).
Line 19: Line 29:
== yMHHcphFbNu == You should submit the `splay_operation.*` file (but not the
`splay_operation_test.*`).
Line 21: Line 32:
sRQhWL , [url=http://jrtbglbwbfps.com/]jrtbglbwbfps[/url], [link=http://cvonmmjhgkjz.com/]cvonmmjhgkjz[/link], http://qwdjjutlcafb.com/ Source code templates can be found in [the git repository](https://gitlab.kam.mff.cuni.cz/datovky/assignments/-/tree/master).
Line 23: Line 34:
== OSIMikBYKDyBGVwUtA == Files splay_operation_more_tests.{cpp,py} contain additional tests
for bugs discovered in students' solutions during this semester.
They are not included on recodex, but your program should pass them
in few seconds.
Line 25: Line 39:
SEN1fw , [url=http://tmliusqnazys.com/]tmliusqnazys[/url], [link=http://srxfatqvibun.com/]srxfatqvibun[/link], http://xhrbxllegxqs.com/
Line 27: Line 40:
== LtUIGTSYrmXgxaYgVwp == ## 3. `Goal`
Line 29: Line 42:
l83mwJ , [url=http://wwkkgfklpumm.com/]wwkkgfklpumm[/url], [link=http://jgoxfeoewgyf.com/]jgoxfeoewgyf[/link], http://dydxssqnqrjh.com/ The goal of this assignment is to evaluate your implementation of Splay trees
experimentally and to compare it with a "naive" implementation which splays
using single rotations only.
Line 31: Line 46:
== pohGwvQVZIpAHa == You are given a test program (`splay_experiment`) which calls your
implementation from the previous assignment to perform the following
experiments:
Line 33: Line 50:
efn94r <a href="http://ivjjhobeabhp.com/">ivjjhobeabhp</a> - _Sequential test:_ Insert _n_ elements sequentially and then repeatedly
&nbsp;&nbsp;find them all in sequential order.
- _Random test:_ Insert _n_ elements in random order and then find _5n_
&nbsp;&nbsp;random elements.
- _Subset test:_ Insert a sequence of _n_ elements, which contains arithmetic
&nbsp;&nbsp;progressions interspersed with random elements. Then repeatedly access
&nbsp;&nbsp;a small subset of these elements in random order. Try this with subsets of
&nbsp;&nbsp;different cardinalities.

The program tries each experiment with different values of _n_. In each try,
it prints the average number of rotations per splay operation.

You should perform these experiments and write a report, which contains the following
plots of the measured data. Each plot should show the dependence of the average
number of rotations on the set size _n_.

- The sequential test: one curve for the standard implementation, one for the naive one.
- The random test: one curve for the standard implementation, one for the naive one.
- The subset test: three curves for the standard implementation with different sizes
&nbsp;&nbsp;of the subset, three for the naive implementation with the same sizes.

The report should discuss the experimental results and try to explain the observed
behavior using theory from the lectures. (If you want, you can carry out further
experiments to gain better understanding of the data structure and include these
in the report. This is strictly optional.)

You should submit a PDF file with the report (and no source code).
You will get 1 temporary point upon submission if the file is syntantically correct;
proper points will be assigned later.

### Test program

The test program is given three arguments:
- The name of the test (`sequential`, `random`, `subset`).
- The random seed: you should use the last 2 digits of your student ID (you can find
&nbsp;&nbsp;it in the Study Information System – just click on the Personal data icon). Please
&nbsp;&nbsp;include the random seed in your report.
- The implementation to test (`std` or `naive`).

The output of the program contains one line per experiment, which consists of:
- For the sequential and random test: the set size and the average number of rotations.
- For the subset test: the subset size, the set size, and the average number of rotations
&nbsp;&nbsp;per find. The initial insertions of the full set are not counted.

### Your implementation

Please use your implementation from the previous exercise. Methods `splay()`
and `rotate()` will be augmented by the test program. If you are performing
a double rotation directly instead of composing it from single rotations, you
need to adjust the `BenchmarkingTree` class accordingly.

### Hints

The following tools can be useful for producing nice plots:
- [pandas](https://pandas.pydata.org/)
- [matplotlib](https://matplotlib.org/)
- [gnuplot](http://www.gnuplot.info/)

A quick checklist for plots:
- Is there a caption explaining what is plotted?
- Are the axes clearly labelled? Do they have value ranges and units?
- Have you mentioned that this axis has logarithmic scale? (Logarithmic graphs
&nbsp;&nbsp;are more fitting in some cases, but you should tell.)
- Is it clear which curve means what?
- Is it clear what are the measured points and what is an interpolated
&nbsp;&nbsp;curve between them?
- Are there any overlaps? (E.g., the most interesting part of the curve
&nbsp;&nbsp;hidden underneath a label?)

In your discussion, please distinguish the following kinds of claims.
It should be always clear which is which:
- Experimental results (i.e., the raw data you obtained from the experiments)
- Theoretical facts (i.e., claims we have proved mathematically)
- Your hypotheses (e.g., when you claim that the graph looks like something is true,
&nbsp;&nbsp;but you are not able to prove rigorously that it always holds)

Source code templates can be found in [git](https://gitlab.kam.mff.cuni.cz/datovky/assignments/-/tree/master).

## 4. `ab tree`
You are given a representation of _(a, b)-tree_ with a `find` operation,
and a representation of an _(a, b)-tree node_.

Your goal is to implement an `insert` operation, which inserts the given
key in the tree (or does nothing if the key is already present). Preferably,
you should also implement `split_node` method and use it properly in
your `insert` implementation.

The implementation uses the variant of (a,b)-trees from lecture notes by [Martin Mares,
Chapter 3](http://mj.ucw.cz/vyuka/dsnotes/03-abtree.pdf) where the actual values are
stored also in the internal nodes of the tree and not only in leaves.

You should submit the `ab_tree.*` file (but not `ab_tree_test.*` files).

Source code templates can be found in [git](https://gitlab.kam.mff.cuni.cz/datovky/assignments/-/tree/master).