-
Help finishing problem
I don't how to explain the question that was asked, I think it was something like write a program using arrays that would subtract eash interger in the array? anyway something like this
array 1/2/5/10/17 then the next array would look like this 2/5/7 then keep subtracting until it reaches zero
heres what I have so far don't give me the answer but any hints would be helpful thanks
Int[] seqDiff(int[] a){
int[] temp= new int[a.length -1];
for(int i = 0; i<temp.length; i++)
tmp[i] =a[i+1]-a[i]
Return temp;
}
I don't know how to make it stop
-
1-)all elements of temp array's may reach zero
(there is no guarantee ).
you may check it with in a loop. i suggest to write a seperate function doing it . ( forexample boolean isSolved( int[] a) )
2-or you will have a list which include only 1 element ( non-zero ) so you cant go further.
this means method is not proper for that data
or you have not enough points ( data ) to solve it in that way.
you may search "newton interpolation"
to learn more abouth this method.
Similar Threads
-
By Irina in forum ASP.NET
Replies: 0
Last Post: 11-29-2002, 10:47 PM
-
Replies: 0
Last Post: 12-13-2001, 12:06 PM
-
By Roseta in forum VB Classic
Replies: 0
Last Post: 11-14-2001, 03:24 AM
-
By Ayman in forum VB Classic
Replies: 0
Last Post: 04-03-2000, 01:08 AM
-
By Jason Bock in forum VB Classic
Replies: 0
Last Post: 03-21-2000, 06:48 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks