This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ConsoleApplication1 | |
//Class program is our naming convention. | |
//Capitalize classes and not functions. | |
//Node head is the start of the linked list. | |
//Next points to the next node in the list. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Void Reverse (Node head) | |
{ | |
Node prev= null; | |
Node current = head; | |
Node nextNode = null; | |
while (current!=null) | |
{ | |
nextNode = current.Next; | |
current.Next = prev; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Main() | |
Dim list As ICollection(Of String) = New LinkedList(Of String) | |
list.Add("Blaine" & Environment.NewLine) | |
list.Add("Likes" & Environment.NewLine) | |
list.Add("Beer" & Environment.NewLine) | |
For Each word In list | |
Console.Write(word & " ") | |
Next | |
Console.WriteLine() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//namespace names this object. | |
namespace blaine | |
{ | |
class helloworld | |
{ | |
//Every program starts with a Main method. | |
//Static indicates that you can access this method without having an object of your class available. | |
//void indicates to the compiler that your method will not return a value to the calling method. | |
static void Main() | |
{ |