Q: I have four functions total:
I'm having problems with the last step and don't know how to set up the loops and everything to reorganize the array. Can you give me some good advice on that?
A:
Ok, first of all, your approach to the problem is great.
But your last function seems to have a difficult strategy. Try this instead:
Since the loop counts down, you should go through each run starting with the largest and ending with the smallest!
Q: Did you know that project 7 isn't due till
tuseday? i mite be able to get it
done by then.
A: Yes I did. Do you feel lucky.....punk
Q: The problem definition states that we are
supposed t sort in ascending order. It doesn't account for 2 identical numbers in a
row - How would you like the program to implement this?
A: Don't start a new run if the numbers
are identical. Only start a run if the next number is smaller.
Q: I have no idea what a run is.
A: Well little buddy, let's look at
Glinert's example:
The worst case would be if all the numbers were in descending order, then you would have the same amount of runs as you do numbers!
Q: What is a good way to approach
solving this program. I don't know where to start!
A: There are several ways to attack this
problem, and many will work. Some people may feel more comfortable using a
2-D array and sticking each run into each row of the array. You could
accomplish this by putting the first run in the first row, then have a
"check" for when the next run starts and go to the next row. You will
also need another array to hold the sizes of each run. While this will
work fine, it may be tricky for people who don't know how to use nested
for-loops.
Another way, would be to have 3 separate arrays.
Finally, start to write the program slowly, taking baby steps. First just get your program to put the indexes in the second array. Then, when that works fine, write another function that fills in the third array with the sizes of the runs. And then finally, after you have all three arrays filled in correctly, get the program to output the runs from biggest to smallest.
Q: I have been working on my program
for quite a while now. I almost
have it, only it tells me that I have exceeded my quota. I have no clue where
all the space is going? I have nothing in my directories. My 'yesterday' file
is taking up 52% of the space. My quota is 7000 and not 5000, but still it
would not save my program.
A: First of all, don't worry about your
yesterday directory taking up disk space (it's all stored on a backup server).
Second, try to look for large hidden files. Do this by typing:
Also another answer is to clear the cache in Netscape. It download tons of pictures and these really build up quickly.
|
TA SLAUGHTERS UNDERGRAD : Bloodbath during office hours . Insane rage rumored to be sparked by a single email message - Judge's verdict: Justifiable homicide. |