<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=0757_-_Bi_Max</id>
	<title>0757 - Bi Max - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=0757_-_Bi_Max"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0757_-_Bi_Max&amp;action=history"/>
	<updated>2026-06-17T06:24:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=0757_-_Bi_Max&amp;diff=8872&amp;oldid=prev</id>
		<title>Brianna Waltner at 15:37, 3 January 2024</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0757_-_Bi_Max&amp;diff=8872&amp;oldid=prev"/>
		<updated>2024-01-03T15:37:16Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:37, 3 January 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l10&quot;&gt;Line 10:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 10:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exemplul 1 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exemplul 1 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;bimaxin.txt&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;bimaxin.txt&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; Datele de intrare corespund restrictiilor impuse&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  67 51 18 0 0 24 0 0 48 0 11 0 0&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  67 51 18 0 0 24 0 0 48 0 11 0 0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;bimaxout.txt&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;bimaxout.txt&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; Datele de intrare corespund restrictiilor impuse&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  51 48&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  51 48&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exemplul 2 ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Exemplul 2 ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Brianna Waltner</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=0757_-_Bi_Max&amp;diff=8870&amp;oldid=prev</id>
		<title>Brianna Waltner: Pagină nouă: == Cerinţa == Se consideră un arbore binar în care nodurile memorează numere naturale nenule. Să se determine valorile maxime din subarborii stâng și drept ai rădăcinii. == Date de intrare == Fișierul de intrare &#039;&#039;&#039;bimaxin.txt&#039;&#039;&#039; conține pe prima linie lista valorilor memorate în nodurile arborelui, obținute în urma parcurgerii în preordine (rădăcină, stâng, drept). Dacă un nod nu are descendent stâng, în listă va apare valoarea &#039;&#039;&#039;0&#039;&#039;&#039;. Dacă un nod nu...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=0757_-_Bi_Max&amp;diff=8870&amp;oldid=prev"/>
		<updated>2024-01-03T15:35:00Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Cerinţa == Se consideră un arbore binar în care nodurile memorează numere naturale nenule. Să se determine valorile maxime din subarborii stâng și drept ai rădăcinii. == Date de intrare == Fișierul de intrare &amp;#039;&amp;#039;&amp;#039;bimaxin.txt&amp;#039;&amp;#039;&amp;#039; conține pe prima linie lista valorilor memorate în nodurile arborelui, obținute în urma parcurgerii în preordine (rădăcină, stâng, drept). Dacă un nod nu are descendent stâng, în listă va apare valoarea &amp;#039;&amp;#039;&amp;#039;0&amp;#039;&amp;#039;&amp;#039;. Dacă un nod nu...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Cerinţa ==&lt;br /&gt;
Se consideră un arbore binar în care nodurile memorează numere naturale nenule. Să se determine valorile maxime din subarborii stâng și drept ai rădăcinii.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Fișierul de intrare &amp;#039;&amp;#039;&amp;#039;bimaxin.txt&amp;#039;&amp;#039;&amp;#039; conține pe prima linie lista valorilor memorate în nodurile arborelui, obținute în urma parcurgerii în preordine (rădăcină, stâng, drept). Dacă un nod nu are descendent stâng, în listă va apare valoarea &amp;#039;&amp;#039;&amp;#039;0&amp;#039;&amp;#039;&amp;#039;. Dacă un nod nu are descendent drept, în listă va apare valoarea &amp;#039;&amp;#039;&amp;#039;0&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
== Date de ieșire ==&lt;br /&gt;
Fișierul de ieșire &amp;#039;&amp;#039;&amp;#039;bimaxout.txt&amp;#039;&amp;#039;&amp;#039; va conține pe prima linie două valori &amp;#039;&amp;#039;&amp;#039;X&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;Y&amp;#039;&amp;#039;&amp;#039;, reprezentând valoarea maximă din subarborele stâng, respectiv valoarea maximă din subarborele drept.&lt;br /&gt;
== Restricţii şi precizări ==&lt;br /&gt;
* se recomandă folosirea arborilor alocați dinamic.&lt;br /&gt;
* se garantează că rădăcina are doi descendenți direcți&lt;br /&gt;
== Exemplul 1 ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;bimaxin.txt&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 Datele de intrare corespund restrictiilor impuse&lt;br /&gt;
 67 51 18 0 0 24 0 0 48 0 11 0 0&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;bimaxout.txt&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 51 48&lt;br /&gt;
== Exemplul 2 ==&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;bimaxin.txt&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 1 0 0&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;bimaxout.txt&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
 Datele de intrare nu corespund restrictiilor impuse&lt;br /&gt;
== Rezolvare ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
class Node:&lt;br /&gt;
    def __init__(self, value):&lt;br /&gt;
        self.value = value&lt;br /&gt;
        self.left = None&lt;br /&gt;
        self.right = None&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def build_tree(values):&lt;br /&gt;
    value = next(values)&lt;br /&gt;
    if value == 0:&lt;br /&gt;
        return None&lt;br /&gt;
    node = Node(value)&lt;br /&gt;
    node.left = build_tree(values)&lt;br /&gt;
    node.right = build_tree(values)&lt;br /&gt;
    return node&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def find_max(node):&lt;br /&gt;
    if node is None:&lt;br /&gt;
        return 0&lt;br /&gt;
    return max(node.value, find_max(node.left), find_max(node.right))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
def main():&lt;br /&gt;
    with open(&amp;#039;bimaxin.txt&amp;#039;, &amp;#039;r&amp;#039;) as fin:&lt;br /&gt;
        values = list(map(int, fin.readline().split()))&lt;br /&gt;
    root = build_tree(iter(values))&lt;br /&gt;
    if root is None or root.left is None or root.right is None:&lt;br /&gt;
        print(&amp;quot;Datele de intrare nu corespund restrictiilor impuse&amp;quot;)&lt;br /&gt;
        return&lt;br /&gt;
    print(&amp;quot;Datele de intrare corespund restrictiilor impuse&amp;quot;)&lt;br /&gt;
    left_max = find_max(root.left)&lt;br /&gt;
    right_max = find_max(root.right)&lt;br /&gt;
    with open(&amp;#039;bimaxout.txt&amp;#039;, &amp;#039;w&amp;#039;) as fout:&lt;br /&gt;
        fout.write(f&amp;quot;{left_max} {right_max}&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    main()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Brianna Waltner</name></author>
	</entry>
</feed>