עזרה בתרגיל ב JAVA - תכנות - HWzone פורומים
עבור לתוכן
  • צור חשבון

עזרה בתרגיל ב JAVA


ElemenTal

Recommended Posts

התרגיל הראשון פה - http://www.kadman.net/bagrut/899205/t205_03.pdf

זה מה שעשיתי

	public static List<Integer> amountOfIndicates (List<Integer> lst)
{
List<Integer> newList = new List<Integer>();
Node<Integer> temp = lst.getFirst();
Node<Integer> next = temp.getNext();
Node<Integer> pos = null;
int sum = 0;
while (next.getNext() != null)
{
sum = 0;
sum = temp.getInfo();
while (next.getInfo() > temp.getInfo())
{
sum += next.getInfo();
temp = next;
next = next.getNext();
}

pos = newList.insert(pos, sum);
temp = next;
next = next.getNext();
}

return newList;
}

אני לא יודע איך לשמור את הסכום של התת רשימה האחרונה

קישור לתוכן
שתף באתרים אחרים

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

×
  • צור חדש...