ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1290. Sabotage

Fun solution in Red-Black Tree
Posted by Michail Yudin 10 Apr 2009 20:34
Eng
http://en.wikipedia.org/wiki/Red-black_tree
Ru
http://ru.wikipedia.org/wiki/%D0%9A%D1%80%D0%B0%D1%81%D0%BD%D0%BE-%D1%87%D1%91%D1%80%D0%BD%D0%BE%D0%B5_%D0%B4%D0%B5%D1%80%D0%B5%D0%B2%D0%BE
Solution
[code deleted]
////////////////////////
solution for fun only - balanced binary search tree;
treeprint do the RightRootLeft (ПКЛ-алгоритм по русски) to print the results

прикольна =))) только для совсем трушных кодеров

Edited by author 10.04.2009 21:38

Edited by moderator 19.11.2019 22:28
Re: Fun solution in Red-Black Tree
Posted by Глащенко Никита 10 Apr 2009 20:42
if (this==0) return 0;   // You are Ъ.
Re: Fun solution in Red-Black Tree
Posted by Michail Yudin 10 Apr 2009 21:37
поправил, забыл убрать =)
Re: Fun solution in Red-Black Tree
Posted by [SPbSU ITMO] WiNGeR 11 Apr 2009 03:16
Существуют и гораздо более простые варианты сбалансированных деревьев чем Red-Black)
http://en.wikipedia.org/wiki/Treap
http://en.wikipedia.org/wiki/Splay_tree
Re: Fun solution in Red-Black Tree
Posted by Michail Yudin 11 Apr 2009 13:45
да я знаю, просто на саботаже хорошо тестить правильность построения деревьев.
про эти деревья как я понял - одно дерамиды, второе не знаю, но есть еще авл-деревья.
впрочем красно-черные самые труЪ с++ весь на них
Re: Fun solution in Red-Black Tree
Posted by Глащенко Никита 12 Apr 2009 20:04
Не C++, а STL.
   Grammar Nazi следит за тобой...
Re: Fun solution in Red-Black Tree
Posted by Cris 14 Apr 2009 15:03
#include "algorithm"
...//input
sort(a,a+n);
...//output

it is my program))

Edited by author 14.04.2009 15:03
Re: Fun solution in Red-Black Tree
Posted by gnaggnoyil 16 Sep 2009 16:56
Why not use SizeBalancedTree? It is much faster and more convenient.
Just #include <everything>
Posted by tiancaihb 23 Oct 2009 07:26
#include <fstream>
#include <string>
#include <cstring>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <sstream>
#include <time.h>
#include <queue>