VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1 ]
Subject: spurningar


Author:
No name
[ Next Thread | Previous Thread | Next Message | Previous Message ]
Date Posted: 15:45:59 05/02/04 Sun

halló
hérna eru nokkrar spurningar
1.
Er nokkuð fyrsti hnútur í tendum lista haushnútur nema
hann sé "dummy node"? semsagt ef enginn dummy node þá
bara hausbendir á fyrsta hnút.


2.
ef maður ætlar að taka út hnút nr. N úr
tengdum lista hvort notar maður
a) void remove(node *h, int N)
eda
b) void remove(node *&h, int N)
ég hélt að maður þyrfti ekki reference því bendirinn
í aðferðinni bendir í raun á sama stað og bendirinn
í main.
???

3.er ekki
typedef node *link
link x

sama og
node *x

4.
hérna er aðferð bls 247 prog. 5.15
hvernig breytir maður þessu í in eða postorder?

preorder traversal (nonrecursive)

void traverse (link h, void visit(link))
{STACK s(max);
s.push(h);
while (!s.empty())
{ visit (h=s.pop());
if(h->r!=0) s.push(h->r);
if(h->l!=0) s.push(h->r);
}
}


eins og ég skil það sem stendur í textanum þá
á að vera nóg að gera

if(h->r!=0) s.push(h->r);
visit (h=s.pop());
if(h->l!=0) s.push(h->r); fyrir inorder

og

if(h->r!=0) s.push(h->r);
if(h->l!=0) s.push(h->r);
visit (h=s.pop()); fyrir postorder

(sbr 5.14, recursive fall)

en sé ekki að það gæti gengið.

[ Next Thread | Previous Thread | Next Message | Previous Message ]

Replies:
Subject Author Date
Re: spurningarNo name16:31:47 05/02/04 Sun


Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]


Forum timezone: GMT+0
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.