|FROM ||Ruben Safir
|SUBJECT ||Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
|From owner-learn-outgoing-at-mrbrklyn.com Fri Jan 23 06:23:56 2015
Received: by mrbrklyn.com (Postfix)
id C57A716116D; Fri, 23 Jan 2015 06:23:56 -0500 (EST)
Received: by mrbrklyn.com (Postfix, from userid 28)
id B6149161174; Fri, 23 Jan 2015 06:23:56 -0500 (EST)
Received: from mailbackend.panix.com (mailbackend.panix.com [220.127.116.11])
by mrbrklyn.com (Postfix) with ESMTP id 37B7C16116D
for ; Fri, 23 Jan 2015 06:23:56 -0500 (EST)
Received: from [10.0.0.19] (unknown [18.104.22.168])
by mailbackend.panix.com (Postfix) with ESMTPSA id 1095F17D25
for ; Fri, 23 Jan 2015 06:23:55 -0500 (EST)
Date: Fri, 23 Jan 2015 06:23:55 -0500
From: Ruben Safir
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0
Subject: Re: [LIU Comp Sci] Algorithms Assignment 1 attempt
Content-Type: text/plain; charset=utf-8
On 01/22/2015 07:34 PM, Maneesh Kongara wrote:
> Sure thing. I'll post mine on the group soon.
I was thinking last night, as I was sleeping, that I'm not even happy
with this result. the problem is what happens if you drop a data point
far off the existing data, so that, say, you have an array of 100 and 10
items in the array in positions from 0-10. Then I InsertByPosition,
into spot 61. You have junk between L.a[L.last] and L.a (the 61st
You need to clean all that out so you have to have a third condition
within that function for insertions past last and before the end of the
Also, this whole thing should be rewritten with pointers.
intpt * = L.a; and then do the math like that. It is much cleaner and
> On Jan 22, 2015 7:30 PM, "Ruben Safir" wrote:
>> I've loaded my version of assignment 1 onto the NYLXS webserver at
>> Look it over and please edit and comment
>> A few thoughts:
>> First, I changed to order of the function listings because we are not
>> using function declarations so the order that they are defined is
>> essential because they call each other. Ideally, one would make a .h file.
>> Secondly, the given skeleton was essentially broken and I had to rewrite
>> all the functions. As it was, it not only didn't track the last entries
>> correctly near L.n == L.last, but also used an incorrect algorithm to
>> find is a list was full
>> Thirdly, I reduced the size of the array from 100 to 5 so I could debug
>> it and show who it works.
>> Fourthly, it takes some interpretation of the intent of the assignment
>> specifications to correctly right the code. This is all to common of a
>> problem. Give me the Spec! (I guess UML might be good for something).
>> As such, when the array is full and I'm adding from the last, then I
>> chose to push results forward and bump the first value. Likewise, for
>> InsertBegin, I push everything forward. He wrote this, actually, but I
>> filled in the case of what to do when the array is filled. I then give
>> a warning and bump the last value out of the array.
>> Fifth: See my makefile and do yourself a favor and copy it and use it.
>> BTW - GVIM is your friend.
>> Sixth: I let debugging code in my code. You can best run it like this
>> list 2> /dev/nulll
>> Even with that, it is quite chatty.