Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Need Coding

37 views
Skip to first unread message
Message has been deleted

Alf P. Steinbach

unread,
Dec 22, 2016, 2:26:39 AM12/22/16
to
On 22.12.2016 07:58, iqra...@gmail.com wrote:
> [homework assignment redacted]

http://www.dietmar-kuehl.de/mirror/c++-faq/how-to-post.html#faq-5.2

Cheers & hth.!,

- ALf


Sal LO

unread,
Dec 22, 2016, 10:05:28 AM12/22/16
to

Tim Rentsch

unread,
Dec 23, 2016, 1:48:59 AM12/23/16
to
iqra...@gmail.com writes:

> Can anyone do C++ coding for below pseudocode. I will be really
> thankful.
>
> INPUT:Ni, Hopmin ,i,SNi
> OUTPUT:NHi
>
> 1: for(AllnodesinlistNi)do
> 2: ComputeCostij,j2Ni
> 3: endfor
> 4: j=firstelementofNi
> 5: while(NotendoflistNi)do
> 6: if(HOPmin,j+1==HOPmin,i)then
> 7: addjtoSNi
> 8: endif
> 9: j=nextelementofNi
> 10: endwhile
> 11: SortSNi(indescendingorderofCostij)
> 12: NHi=FirstelementofthelistSNi

I'm trying to resist the temptation to post C++ code for this
pseudocode... oh what the heck....

typedef std::vector<int> VI;

void
something( VI Ni, int Hopmin, int i, VI SNi, int *NHi ){
auto Costij = 0;
extern void Compute( int );
auto j2Ni = 0;
for( auto node : Ni ){
Compute( Costij ),j2Ni;
}
auto j = Ni.begin();
while( ! (j == Ni.end()) ){
if( Hopmin, *j+1 == Hopmin, i ){
SNi.push_back( *j );
}
j += 1;
}
extern void SortSNI( int );
SortSNI( Costij );
*NHi = SNi.front();
}

The Compute() and SortSNI() functions need to be supplied, and
there may be a few other details in need of correction. I'm sure
though that these are minor issues now that the pseudocode has
been faithfully translated.


P.S. I hope y'all will forgive my little joke. Merry Christmas!

woodb...@gmail.com

unread,
Dec 23, 2016, 11:14:56 AM12/23/16
to
On Friday, December 23, 2016 at 12:48:59 AM UTC-6, Tim Rentsch wrote:
>
> I'm trying to resist the temptation to post C++ code for this
> pseudocode... oh what the heck....
>
> typedef std::vector<int> VI;
>
> void
> something( VI Ni, int Hopmin, int i, VI SNi, int *NHi ){
> auto Costij = 0;
> extern void Compute( int );
> auto j2Ni = 0;
> for( auto node : Ni ){
> Compute( Costij ),j2Ni;
> }
> auto j = Ni.begin();
> while( ! (j == Ni.end()) ){
> if( Hopmin, *j+1 == Hopmin, i ){
> SNi.push_back( *j );
> }
> j += 1;
> }
> extern void SortSNI( int );
> SortSNI( Costij );
> *NHi = SNi.front();
> }
>
> The Compute() and SortSNI() functions need to be supplied, and
> there may be a few other details in need of correction. I'm sure
> though that these are minor issues now that the pseudocode has
> been faithfully translated.
>
>
> P.S. I hope y'all will forgive my little joke. Merry Christmas!

Happy Chanukah also.


Brian
Ebenezer Enterprises - "If someone curses their father or mother,
their lamp will be snuffed out in pitch darkness." Proverbs 20:20

http://webEbenezer.net
0 new messages