@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19



Comments:

<0> ves3ks i'ts going to be O(n)
<1> yes, the solution i have now is linear, i just use an array
<1> with the indices to represent the ordered numbers
<2> and use range I think
<1> and the elements are just added in a loop within the range
<1> but im told there is a constant time solution
<3> isn't there a formula that equals to that series?
<1> which series?
<2> I cannot see a constant time solution for arbitrary numbers
<0> ves3ks I think someone lied to you...or there is something about the numbers you haven't told us
<2> whomever invents one is a genius :)
<1> the arbitrary numbers are referenced by ordered numbers
<0> ves3ks that doesn't matter a whole lot
<1> mind if i paste some stuff? might spam some
<0> ves3ks can you read the topic?
<2> ves3ks, accumulate is the STL function you want



<1> ok
<1> http://www.noidea128.org/sourcefiles/15843.html
<2> accumulate(v.begin(), v.end(), startint);
<1> here's the actual question
<4> vawjr: sorry, was coding it. This is for a queue of channels to be processed. However, there is a time_t (unixtime) involved as the channels with a time_t greater than a number are the only ones processed. I have to be able to find elements in the map, delete, and walk the entire map.
<5> when I declare an array int A[10];
<5> do I say array A or array *A ?
<2> neither
<5> enlighten me
<2> int A[10];
<1> http://www.noidea128.org/sourcefiles/15843.html
<0> and that defines an array of int called A with 10 elements
<3> ves3ks, are you wanting to find the value of, sum(i, i=a..n); ?
<1> YUY: no
<2> sum(a[i], i=a..a[n])
<1> sum(a[i], i=a..n)
<2> err yeah I screwed that up too
<5> vawjr, so if I have a pointer double *A;
<5> how do I formulate the English language
<5> to suit the semantics of C/C++ ?
<1> http://www.noidea128.org/sourcefiles/15843.html that link will take you to the question
<0> ves3ks I think I'd create a cache of answers
<5> when A is to be used with malloc later
<5> is it still an array?
<0> corstan yes, why are you ****ing with arrays ?
<1> but wouldn't you have to go through the array to create the cache in the first place?
<0> oh yeah, you're in school
<3> it would be actually sum(distances[i], i=a..n)
<0> ves3ks yes
<2> its a pointer untill it is explicitly allocated as a pointer to multiple elements
<1> so basically a constant time solution is unfeasible
<1> without some sort of initialization
<0> amortized constant time would be workable
<5> Twister2, so that's what I say it is when I know that it is to be used as a pointer to multiple elements ?
<5> i.e. pointer A
<5> and not array A
<5> when double *A;
<0> corstan to WHOM are you wanting to "say"
<2> its a dynamic array corstan
<5> to whoever and whatever that is going to read me code
<2> "dynamic array" or "dynamically allocated array"
<0> most of them understand what double* widget; means
<2> ves3ks, you definatley want to do as vawjr said
<0> you don't really need to say a lot
<1> you mean with the cache?
<5> maybe it's you vawjr, and when I mistype the attribute of A you start to flame?
<5> ok
<2> yeah, some sort of pre calculation
<0> Twister2 or calc as the calls are made
<2> right, just never the same calc twice
<5> Twister2, so it's dynamic array A ?
<5> when malloc()
<2> not untill its allocated
<0> corstan well, I think you're being dragged around by the **** by someone who doesn't know how to teach C++ and it's very frustrating seeing you be so confused
<5> hehe
<1> i can't do that because i have to keep memory in O(n)
<2> and malloc is C, not C++.
<0> and you should RARELY use malloc in a C++ program
<0> ves3ks ???
<5> new delete then
<5> wonder what happens if I mix malloc and delete



<5> :)
<2> bad things I would ***ume
<2> or at least undefined things?
<2> ves3ks, no where does it mention memory usage.
<5> my teacher explicitly prohibts mixing them :)
<5> never! never!
<2> well, glad that point hit home...
<2> ves3ks, this problem has me intrigued now heh
<1> Twister2, memory usage was not mentioned there
<1> but in a response to the original function i wrote
<5> is the core of Windows XP written in purely C++ (visual) ?
<0> corstan your teacher should explicitly prohibit malloc
<1> i was told that 1) it could be done in constant time instead of linear and 2) id have to not use up any more memory than i already am
<5> vawjr, it's a two-part course in C/C++
<5> simultaneously
<0> well, they're doin it ALL wrong
<2> ves3ks, then you need to find a more efficient way to represent the data
<5> vawjr, hmm
<5> not sure what I can do, I need to learn this
<0> and what data do you have now?
<0> yeah, after you learn some other stuff
<1> im representing the data in an array
<0> but you don't need to learn malloc
<1> indices as the ordered numbers from 0 to N-1
<5> I don't need to?
<2> oh, its a turnpike... thus the numbers are sequential
<0> the differences between adjacent cities?
<1> yes
<2> ok, thats VERY important
<0> corstan the likelyhood of you using it is about nil
<2> you do a summation of the total miles.
<5> I use it all the time in my C ***ignments
<2> so, you transform the array as N + n-1
<2> then you subtract.
<0> yeah, C doesn't have a new that's all you got
<5> yes
<1> N + n-1?
<2> ves3ks, then your done... in C time.
<0> ah, ves
<0> yes you can do it in one O(n) p*** over the data, then O(1) afterwards
<2> yup
<0> brain finally clicked in
<1> sorry, my brain's not working well tonight, please elaborate
<2> details are important :) I missed the 'turnpike' word till just now :)
<0> and there's even a standard library to make the O(n) p***
<2> you have 1 4 6 2 transform it to:
<2> 1, 5, 11, 13
<2> then any sequence is destination - start
<1> rofl...
<1> im a dumb***
<0> and you want to use partial_sum to generate the new data
<6> i am going to ask you a paranormal question about compilers, metaphysics and randomness. i have two folders... a and b. i put my code in a and in b. (windows) i run .net 2003 and compile the same code in both. i use the same options (same project file). i get different EXEs (in size). i run each exe on the same data. i get different results. WTF?
<1> partial_sum?
<7> Q: I have 4 byte value that should really be integer ... 0, 5, 225, 198 ... how to calculate the integer value
<0> ves3ks it's in <algorithm>
<0> XboK what ??
<8> djik, the reason is simple : you're using windows
<2> XBok, with math would be my first guess :)
<1> ok..
<7> C++ int is save in 4 byte.... I look that the byte is 0,5,225,198 ... but i dunno what is the integer value
<1> Twister2: howd u come up with that solution? something you've had experience w/?
<2> ves3ks, no its just obvious after you get all the facts
<7> I know it is math but 225 should multiply what
<0> XboK how do you "look" ?
<2> you figure out what is constant and a relationship between elemtns
<7> like 225 x 2^8 ?
<7> debug window
<1> i see
<6> gribouille, on the same code today, i had something funny happening under linux. when using the intel v9 compiler i got a message that i should call intel's premier support (the compilation never ended). with intel v8 there were no problems. with gcc, no problems. with pathscale no problems. pgi? no problems.
<1> maybe im not cut out for this then heh
<0> XboK what OS? what debugger??
<1> cuz i didn't see it
<7> VS2003 windowsXPpro


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #c++
or
Go to some related logs:

#linuxhelp
#MissKitten
setting fschk redhat
#linux
#chatzone
domapi get row
#mirc
#AllNiteCafe
psybnc freenode tor
#c++



Home  |  disclaimer  |  contact  |  submit quotes