I have an array with a lot of numbers. How can I create intervals from these numbers?
kovacsakos 0 Newbie Poster
Recommended Answers
Jump to Postwhat's the value of the intervals?
I see in your example that the first set has a length of 5 but the next one only has 2 and at the last is probably for the remaining elements, is there a pattern for this?once you know the value of the …
Jump to PostWhy 0-5, 6-9, 12-13?
Why not 0-3, 4-8, 9-13?
Or 0-1, 2-3, 4-5, 6-8, 9-13?My attempt is here, but there is a problem with this:
So what's the problem with this?
Jump to PostBecause 7 , 10 and 11 is not in the array.
what does missing numbers have to do with intervals?
So the length is not important. The intervals will be different long.
I meant that the value of the interval is important to act as a …
Jump to PostWhile loop until no more numbers set intervalStart to current number Loop until you don't get the "next number" in sequence Set previous number to intervalEnd print interval endWhile
All 16 Replies
DrunkenCoffin -3 Newbie Poster
WaltP commented: No, not fine. We don't do other's homework for them. -3
kovacsakos 0 Newbie Poster
zeroliken 79 Nearly a Posting Virtuoso
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
kovacsakos 0 Newbie Poster
kovacsakos 0 Newbie Poster
zeroliken 79 Nearly a Posting Virtuoso
kovacsakos 0 Newbie Poster
zeroliken 79 Nearly a Posting Virtuoso
kovacsakos 0 Newbie Poster
zeroliken 79 Nearly a Posting Virtuoso
kovacsakos 0 Newbie Poster
zeroliken 79 Nearly a Posting Virtuoso
kovacsakos 0 Newbie Poster
zeroliken 79 Nearly a Posting Virtuoso
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.