LinkedList

=Linked List=

A linked list is a data structure that has a pointer to the next value in the list. In java a linked list is simply another class in java's eminence library of classes. In c++ however the work falls on the programmer.

In C++
code format="cpp"
 * 1) include
 * 2) include

struct node{ char *info; node *next; //pointer to same type

node(char *i){ info = i;       next = NULL; } }; node *start, *end; //our list start and end

void add(node *n){ if(end == NULL){ //initialize the list start = end = n;   }else{ //append the value to the end of the list end->next = n;       end = n;    } }

int main{ add(new node("Derp")); add(new node("Tyler"));

for(node *n = start; n; n = n->next){ //loops through the list printf("%s\n", n->info); }   system("pause"); return 0; } code

In Java
code format="java" import java.util.*;

public class Main{ public static void main(String[] args){ List values = new LinkedList; values.add("Derp"); values.add("Tyler");

for(String s: values){ System.out.println(s); }   } } code