Berkeley CSUA MOTD:Entry 36234
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2024/11/26 [General] UID:1000 Activity:popular
11/26   

2005/2/18-20 [Computer/SW/Languages] UID:36234 Activity:moderate
2/18    To show I am a better man (and christian) than ilyas, here is a
        solution to the hw question asked yesterday (maximum contiguous
        sequence).  Pass 1: coalesce adjacent elements of the array A
        into blocks with the same sign (dropping 0) by summation into array B,
        meanwhile keeping track of their range in array A .  Finding the max
        of the array B during this pass as well.  Pass 2: starting at the
        max block, extending up and down the array B (and hence A), finding
        the max stretch.  You have to prove that it works and it is linear. :)
        \_ anti-semite alert!!!
           \_ I don't think ilyas is Jewish
              \_ No, he's either Tzimisce or Silverfang lupus theurge.  Aren't
                 you paying attention?  *sheesh*
                 \_ mislycanthropy alert?!
        \_ Doesn't this give 4 instead of 5 for  A = B = (4, -8, 3, -1, 3)?
        \_ What's wrong with you dude? We solved this already in one pass.
           Just stop already.
           \_ Was it O(n) or O(n^2)?
              \_ One pass, O(n). I don't see what's the big deal. Keep a
                 running count of the "current sequence", and the value/index
                 where it was highest. The "current sequence" is over if
                 (count + next) < next. Store the best sequence as you go.
                 \_ Except that doesn't work. -- ilyas
                    \_ Counterexample? You may call me stupid rather than lazy.
                       Although being anonymous helps me in either case.
                       \_ Think of one yourself.  Lazy bitch. -- ilyas
                          \_ I choose to think I'm right and you're stupid.
                             \_ Let me know what you get on your homework.
                                  -- ilyas
        \_ cool!  christians rule.
        \_ Not only have you encouraged the deadly sin of Sloth in the original
           poster of the question, but you have succumbed to the deadly sin of
           Pride yourself (by posting something that doesn't work).
           You -> Hell.  It's trivial to see that starting from the max block
           can fail to work. -- ilyas
           \_ You just succumbed to the deadly sin of Stupidity for getting
              trolled again.
              \_ Nay, for ilyas knoweth not what he does.
2024/11/26 [General] UID:1000 Activity:popular
11/26   

You may also be interested in these entries...
2011/3/7-4/20 [Computer/SW/Languages/C_Cplusplus] UID:54056 Activity:nil
3/7     I have a C question.  I have the following source code in two identical
        files t.c and t.cpp:
                #include <stdlib.h>
                int main(int argc, char *argv[]) {
                  const char * const * p1;
                  const char * * p2;
	...
2009/4/30-5/6 [Computer/Theory] UID:52923 Activity:nil
4/30    Sorting question!  I have n sorted arrays of doubles.  What's the
        fastest way to sort them into 1 big sorted array?
        \_ as mentioned below: you are describing one half of mergesort
        \_ You really have to ask this question?
           \_ You don't know either, huh?
        \_ If three are n sorted arrays of m doubles each, I think the fastest
	...
2009/4/5-5/3 [Computer/SW/Languages, Computer/HW/Drives] UID:52801 Activity:nil
4/5     Tuesday at 10:00PM I will be taking down Soda temporarily to migrate
        disk arrays.  This is an expected part of our move to the new server.
        The downtime should be minimal - I'll be remounting /home read-only
        for an hour or so while I run a final mirror over to the new array
        and then will reboot Soda onto the new array. The final migration
        will come at a slightly later time - this is in preparation for
	...
2009/1/20-26 [Computer/SW/Languages/Java, Computer/SW/Languages/Misc] UID:52425 Activity:nil
1/20    I've been using tcsh as shell program tool (i know, bad shell to
        do scripting).  One thing I've noticed when I extract xml file
        is that the variable type automatically change from
        integer/string to... almost an array-like data structure when
        the output of the xml key/value is more than one (it's more
        like a string separated by space, but I was very impressed as
	...
2008/12/4-10 [Computer/HW/CPU, Computer/HW/Drives] UID:52163 Activity:nil
12/4    A question to you old crufy alumni: So lately we've suggested
        VMs, and been asked why it's necessary. We've suggested top-of-the-line
        hardware and been told we don't need that much power. So I'd like to
        ask -- what exactly do you think the CSUA is supposed to _be_?
        \_ Noone said VMs weren't needed.  They suggested you use the
        \_ No one said VMs weren't needed.  They suggested you use the
	...
2008/11/29-12/6 [Computer/SW/OS/FreeBSD, Computer/SW/OS/VM] UID:52129 Activity:moderate
11/29   I'm experimenting with virtualization, and as a poor college student
        I'm wondering what the best alternatives for virtualization are, and
        how best to cut my teeth on messing with non-linux platforms (or I
        guess interesting stuff on Linux would work too). Right now I've got
        FreeBSD7 running on KVM on my home computer (on a Core 2 Quad), and am
        somewhat at a loss as to how to use it. (More details: bridged
	...
2008/11/24-29 [Computer/SW/Languages/C_Cplusplus] UID:52093 Activity:nil
11/23   C++ question: If I have "char *p = new char[10];", is there any real
        difference between "delete p;" and "delete[] p;" after compilation?
        The Standard C free() function only has one form and works for freeing
        both a single character and a character array.  Why are there separate
        forms in C++?  Thx.
        \_ For an array of char, there's no difference.  If you have an array
	...
2008/6/9-12 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Security] UID:50194 Activity:nil
6/8     CSUA code guru please help. I need to see my random number
        generator with a good seed (I just need random 18 bit
        identifiers). The usual time(NULL) is OK, except my program
        might be invoked faster than once a second, and seeding using
        time() produced the same result. I tried clock() but it seems
        to return 0. My program needs to be run in Linux/DOS (Watcom
	...
2008/4/29-5/5 [Computer/SW/Languages/Perl, Computer/SW/Languages/Python] UID:49852 Activity:moderate
4/29    Scaling your web app in the real world:
        http://teddziuba.com/2008/04/im-going-to-scale-my-foot-up-y.html
        \_ This article is crap.  While yes, 99.9% of all websites don't
           need any serious scalability plans, if any of them become worth
           anything they will need to scale.  If you write a web application
           without careing about scalability you are writing a webapp that can
	...
2007/11/13-16 [Computer/HW, Computer/HW/Drives] UID:48631 Activity:nil
11/12   What is diff between SAN and NAS?
         \_ NAS=Network Attached Storage.  Appliance which provides disk
             to servers/clients via file-based protocols (NFS, CIFS, iSCSI).
            SAN=Storage Area Netwoork.  Provides direct fiber connections from
             multiple servers to a single storage array.  -tom
            \_ Here is another way to explain It: They're very similar in that
	...