University stuff.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. class TegneDS {
  2. public static void main ( String [ ] args ) {
  3. new ElemListe ( args ) ;
  4. }
  5. }
  6. class ElemListe {
  7. private Elem fElem = null;
  8. private Elem sElem = null;
  9. ElemListe ( String [ ] inputstrenger ) {
  10. Elem e = null;
  11. sElem = new Elem( " Sisteelement ?" ) ;
  12. fElem = sElem;
  13. for ( String s : inputstrenger ) {
  14. e = new Elem( s );
  15. sElem.neste = e;
  16. sElem = e;
  17. }
  18. for ( String s : inputstrenger ) {
  19. e = new Elem( s );
  20. e.neste = fElem;
  21. fElem = e;
  22. }
  23. /∗
  24. OPPGAVE tegn datastrukturen slik den ser ut når
  25. programutførelsen har kommet hit
  26. ∗/
  27. }
  28. }
  29. class Elem {
  30. static int ant = 0;
  31. Elem neste;
  32. String ord;
  33. int nr;
  34. Elem ( String s ) {
  35. nr = ant++;
  36. ord = s ;
  37. }
  38. }