Search found 2 matches

by yitriana
Sat Apr 25, 2009 8:04 pm UTC
Forum: Computer Science
Topic: For loops and Stacks
Replies: 3
Views: 2146

For loops and Stacks

Why don't for loops work on stacks? == I am to make a program that collapses integers of a stack. Write a method collapse that takes a stack of integers as a parameter and that collapses it by replacing each successive pair of integers with the sum of the pair. For example, suppose a stack stores th...
by yitriana
Sun Apr 19, 2009 6:01 pm UTC
Forum: Computer Science
Topic: Linked Lists
Replies: 5
Views: 1185

Linked Lists

When the for loop, with ListNode current = list; while (current != null) { System.out.println(current.data); current = current.next; the current keeps resetting to current.next. Doesn't it lose sight of previous values? And then, wouldn't you just have a current list with two actual linked values? A...

Go to advanced search