-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: LovedJohnySmith
Message 3 in Discussion

 
Huh, it is one of Microsoft Corporation Question paper rite :). Let me give you 
the sample code(and pseudo code) for this question. 
  
C++ pseudo code<o:p></o:p> 
<o:p> </o:p> 
node* node = MyFirstNode; <o:p></o:p> 
node* node5 = node->next->next->next->next; <o:p></o:p> 
<o:p> </o:p> 
<o:p> </o:p> 
for(;;) <o:p></o:p> 
{ <o:p></o:p> 
    if(node5->next == 0) <o:p></o:p> 
    { <o:p></o:p> 
        return node->val; <o:p></o:p> 
    } <o:p></o:p> 
    node = node->next; <o:p></o:p> 
    node5 = node5->next; <o:p></o:p> 
<o:p> </o:p> 
}<o:p></o:p> 
<o:p> </o:p> 
C# Implementation<o:p></o:p> 
<o:p> </o:p> 
using System;<o:p></o:p> 
using System.Collections;<o:p></o:p> 
<o:p> </o:p> 
class CodeTest<o:p></o:p> 
{<o:p></o:p> 
static void <st1:place w:st="on">Main</st1:place> ()<o:p></o:p> 
{<o:p></o:p> 
Hashtable htMonth = new Hashtable ();<o:p></o:p> 
<o:p> </o:p> 
htMonth.Add (1, "January");<o:p></o:p> 
htMonth.Add (2, "February");<o:p></o:p> 
htMonth.Add (3, "March");<o:p></o:p> 
htMonth.Add (4, "April");<o:p></o:p> 
htMonth.Add (5, "May");<o:p></o:p> 
htMonth.Add (6, "June");<o:p></o:p> 
htMonth.Add (7, "July");<o:p></o:p> 
htMonth.Add (8, "August");<o:p></o:p> 
htMonth.Add (9, "September");<o:p></o:p> 
htMonth.Add (10, "October");<o:p></o:p> 
htMonth.Add (11, "November");<o:p></o:p> 
htMonth.Add (12, "December");<o:p></o:p> 
<o:p> </o:p> 
// access as collection values (no follower)<o:p></o:p> 
Console.WriteLine ("\nCollection order\n");<o:p></o:p> 
ICollection values = htMonth.Values;<o:p></o:p> 
foreach (string month in values)<o:p></o:p> 
{<o:p></o:p> 
Console.WriteLine ("Month: {0}", month);<o:p></o:p> 
}<o:p></o:p> 
<o:p> </o:p> 
// access by month number<o:p></o:p> 
// with follower 5 behind<o:p></o:p> 
int follow = 0;<o:p></o:p> 
int start_follow = 5;<o:p></o:p> 
Console.WriteLine ("\nMonth number order\n");<o:p></o:p> 
for (int i=0; i < 12; i++)<o:p></o:p> 
{<o:p></o:p> 
Console.Write ("Month: {0}", htMonth [i+1]);<o:p></o:p> 
if (--start_follow < 1)<o:p></o:p> 
{<o:p></o:p> 
Console.Write ("\t\t(Follow Month: {0})", htMonth [++follow]);<o:p></o:p> 
}<o:p></o:p> 
Console.Write ("\n");<o:p></o:p> 
}<o:p></o:p> 
}<o:p></o:p> 
} 
  
Thanx, 
Smith 
http://spaces.msn.com/members/johnysmith 
<o:p></o:p> 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to