Diff for ''
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| <includeonly><div class="thumb {{#switch: {{{align|}}} | left = tleft | center | centre = tnone | tright}} {{#if: {{{noclear|}}} | no-clear }}" style="width:{{#ifeq: {{{direction|horizontal}}} | vertical | {{#expr: {{#if: {{{width|}}} | {{{width}}} | {{{width1}}} }} + 12}} | {{#if: {{{width|}}} | {{#expr: 8 + ({{{width|0}}} + 4) * {{#if: {{{image5|}}} | 5 | {{#if: {{{image4|}}} | 4 | {{#if: {{{image3|}}} | 3 | 2 }} }} }} }} | {{#expr: 16 + {{{width1}}} + {{{width2}}} + {{{width3|0}}} + {{{width4|0}}} + {{{width5|0}}} + {{#if: {{{image5|}}} | 12 | {{#if: {{{image4|}}} | 8 | {{#if: {{{image3|}}} | 4 | 0 }} }} }} }} }} }}px;{{#switch: {{{align|}}} | center | centre = margin: 0 auto;}}"> <div class="thumbinner"> {{#if: {{{header|}}} | <div style="clear:both;font-weight:bold;text-align:{{{header_align|center}}};background:{{{header_background|transparent}}};">{{{header}}}</div> }} <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width1}}} }} }}px;"><div class="thumbimage">[[Image:{{{image1}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width1}}} }}px|{{{caption1|{{{box_caption}}}}}}]]</div>{{#if: {{{caption1|}}} | <div class="thumbcaption" style="clear:left;">{{{caption1}}}</div>}}</div> <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width2}}} }} }}px;"><div class="thumbimage">[[Image:{{{image2}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width2}}} }}px|{{{caption2|{{{box_caption}}}}}}]]</div>{{#if: {{{caption2|}}} | <div class="thumbcaption" style="clear:left;">{{{caption2}}}</div>}}</div> {{#if: {{{image3|}}} | <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width3}}} }} }}px;"><div class="thumbimage">[[Image:{{{image3}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width3}}} }}px|{{{caption3|{{{box_caption}}}}}}]]</div>{{#if: {{{caption3|}}} | <div class="thumbcaption" style="clear:left;">{{{caption3}}}</div>}}</div> {{#if: {{{image4|}}} | <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width4}}} }} }}px;"><div class="thumbimage">[[Image:{{{image4}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width4}}} }}px|{{{caption4|{{{box_caption}}}}}}]]</div>{{#if: {{{caption4|}}} | <div class="thumbcaption" style="clear:left;">{{{caption4}}}</div>}}</div> {{#if: {{{image5|}}} | <div style="{{#ifeq: {{{direction|horizontal}}} | horizontal | float:left;}}margin:1px;width:{{#expr: 2 + {{#if: {{{width|}}} | {{{width}}} | {{{width5}}} }} }}px;"><div class="thumbimage">[[Image:{{{image5}}}|{{#if: {{{width|}}} | {{{width}}} | {{{width5}}} }}px|{{{caption5|{{{box_caption}}}}}}]]</div>{{#if: {{{caption5|}}} | <div class="thumbcaption" style="clear:left;">{{{caption5}}}</div>}}</div>}}}}}} {{#if: {{{footer|}}} | <div class="thumbcaption" style="clear:left;text-align:{{{footer_align|left}}};background:{{{footer_background|transparent}}};">{{{footer}}}</div> }}</div></div></includeonly><noinclude> {{documentation}} <!-- PLEASE ADD CATEGORIES AND INTERWIKIS TO THE /doc SUBPAGE, THANKS --> </noinclude> |
# Binarni vyhledavaci strom - Prolog <{ForumPost(poster="Anonymous", timestamp=2009-06-15 13:10:24)}> Ahoj, nevite, jak v prologu otestovat, zda-li je objekt korektni binarni vyhledavaci strom? Stromy jsou struktury t(LeftSubTree, Root, RighSubTree). Diky moc predem! <{/ForumPost}> <{ForumPost(poster="Him", timestamp=2009-06-15 18:12:22)}> %match(+V,+LftBnd,+RgtBnd) fit(V,LftBnd,RgtBnd):-((number(LftBnd),V>=LftBnd);(LftBnd == nInf)),((number(RgtBnd),V<RgtBnd);(RgtBnd == pInf)). %binTree(+Tree) binTree(t(L,V,R)):-binTree(t(L,V,R),nInf,pInf). binTree(nil,_,_). binTree(t(L,V,R),LftBnd,RgtBnd):-fit(V,LftBnd,RgtBnd),binTree(L,LftBnd,V),binTree(R,V,RgtBnd). Snad to bude ono. Funguje to jednoduse tak, ze si drzim cestou v jakem rozmezi se musi hodnoty vrcholu pro jednotlive podstromy. Pokud se do stromu pridavaji stejne hodnoty, ktere ve stromu jiz jsou tak predikat pocita s tim, ze se davaji vzdy do praveho syna. nInf ~ -oo pInt ~ +oo Dej vedet, jestli to resi tvuj problem ;-) <{/ForumPost}> <{ForumPost(poster="Anonymous", timestamp=2009-06-15 19:39:04)}> Ahoj, vypada to v pohode, diky moc. Mimochodem, psal si to sam nebo to odnekud je? Pokud za b, mohl bys mi prosim napsat, odkud? <{/ForumPost}> <{ForumPost(poster="Him", timestamp=2009-06-15 19:44:40)}> Je to vlastní výroba. Ostatně je to nejpřímější způsob jak to napsat. To bys měl dát dohromady sám, ne? Nebo je na tom něco nejasného? <{/ForumPost}> |