Berkeley CSUA MOTD:Entry 28643
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/24 [General] UID:1000 Activity:popular
5/24    

2003/6/5-6 [Computer/Theory] UID:28643 Activity:moderate
6/5     Someone explain the big-O notation again. Basically O(X) means
        a computation cannot be worse than constant*X, where X could be
        log, exponential, or what not. So isn't it correct to say that
        the big-O for quick sort could be any of the following: O(nlog n),
        O(n^2), O(n^n), O(n!), since quick sort will never be worse than
        these?
        \_ all of those are technically correct (except for O(n log n),
           quicksort is O(n^2) in the worse case). however, when your
           characterization of the running time is that far
           off from the true upper bound, that's not very useful.
           \_ you should look into the difference between big-O, big-theta
              and big-omega notation. I believe SICP and CLR(S) both have
              decent introductions. --twohey
              \_ http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic3
        \_ no because that suggests it could actually be of n! time
           which it can never be. (unless u implement it wrong)
           \_ if you implement it wrong, it shouldnt be called quiksort, it
              shoudl be called slosort or something like that.
              \_ how about "spellsort" or "sloppy, lazy typo sort"?
        \_ If you can give a girl the big-O - youre set.
           \_ But only if you can do it in 0(n) time.
2025/05/24 [General] UID:1000 Activity:popular
5/24    

You may also be interested in these entries...
2012/8/30-11/7 [Computer/SW/Apps, Computer/SW/Unix] UID:54470 Activity:nil
8/30    Is wall just dead? The wallall command dies for me, muttering
        something about /var/wall/ttys not existing.
        \_ its seen a great drop in usage, though it seems mostly functional.
            -ERic
        \_ Couldn't open wall log!: Bad file descriptor
           Could not open wall subscription directory /var/wall/ttys: No such file or directory
	...
2012/1/24-3/3 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Languages/Misc] UID:54296 Activity:nil
1/24    http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html
        Amusing "history" of computer science.
        \_ Where's the mentioning of Al Gore the inventor of AlGorithm?
	...
2011/11/20-2012/2/6 [Computer/Companies/Apple, Computer/SW/Unix] UID:54237 Activity:nil
11/20   Are there tools that can justify a chunk of plain ASCII text by
        replacing words with words of similar meaning and inserting/removing
        commas into the text?  I received a 40-line plain text mail where
        all the lines are justified on left and right.  Every word and comma
        is followed by only one space, and every period is followed by two
        spaces.  The guy is my kid's karate instructor which I don't think is
	...
2011/10/26-12/6 [Computer/SW/Unix] UID:54202 Activity:nil
10/24  What's an easy way to see if say column 3 of a file matches a list of
       expressions in a file? Basically I want to combine "grep -f <file>"
       to store the patterns and awk's $3 ~ /(AAA|BBB|CCC)/ ... I realize
       I can do this with "egrep -f " and use regexp instead of strings, but
       was wondering if there was some magic way to do this.
       \_ UNIX has no magic. Make a shell script to produce the ask or egrep
	...
2011/6/29-7/21 [Computer/SW/Database, Computer/SW] UID:54133 Activity:nil
6/29    "An Israeli algorithm sheds light on the Bible"
        http://www.csua.org/u/tq4 (news.yahoo.com)
        "Software developed by an Israeli team is giving intriguing new hints
        about what researchers believe to be the multiple hands that wrote the
        Bible."
        \_ "Hype developed by an American OnLine News Feed is giving
	...
Cache (4961 bytes)
www.cs.mcgill.ca/~cs251/OldCourses/1997/topic3 -> www.cs.mcgill.ca/~cs251/OldCourses/1997/topic3/
Hypothesis : Exponential is larger than polynomial : Compute the limit of c^n / n^k for c > 1. Substituting n^2k for c^n in the original problem, shows that the limit we desire is the limit of n^2k / n^k. In 1962, based upon physical reasoning, he stated that no computer, biological or artificial, could ever process more than (2 * 10^47) bits of information per second-gram. Now, assume that we protect a computer system with a code consisting of 40 decimal digits. Breaking this code by brute force would in the worst case require trying out 10^40 combinations. In a computer working with Bremermann's speed, that could be done in less than a second, even if the computer weighed only 1 gram. Factorial time TSP TSP is the Travelling Salesman Problem. Let's say you are a salesperson and you have to visit each of n cities to sell your product. You want to visit all the cities and return to the city you came from. You want to find the shortest path possible, visiting all the cities. Obviously, it would be naive to try all the permutations. Many tried their hand on this problem, but few have found a good solution for it. For all n and for all integers a CAPTION: FIGURE 1 n log*n 1 0 2^1=2 1 2^2=4 2 2^4=16 3 2^16=65536 4 2^65536 5 Summations Summations are used extensively in computer science as a mathematical tool to help analyze the running time of algorithms. In computer science, most algorithms are completed through the repitition of simple actions, or loops. Loops are created in two different ways: first, by constructs such as repeat,while,and for, and second, by recursion. In order to analyze the times taken by looping programs, we have to deal with summations, as one must sum the times taken in various iterations. In order to analyze the times taken by recursive programs, we have to deal with recurrences, which is the subject of the next lecture. There are five basic methods for dealing with summations. Rough Bounding Given a summation, we would like to bound each term by something simple, and thus make the summation more managable. While this method will not determine an exact measure of the running time of the algorithm which the summation is supposed to represent, it is useful in achieving bounds to solve Big Oh notation questions. In the example below, the summation represents the running time of many different algorithms, among them selection sort. Exact Computations As the name of the method suggests, we would like to compute an exact numerical value for the summation. Pair off the n numbers such that the first element is grouped with the last element (n^th element), the second is grouped with the (n-1)^th element, and so on. For example, 1 is grouped with n, 2 is grouped with (n-1), 10 is grouped with (n-9), etc. Clearly, each pair sums to (n+1), and there are (n/2) such pairs. Induction Induction can be used to prove a certain statement. We say it is "induction with respect to a parameter n", if we first show it for n = 0. Then we assume the statement to be true up to but not including n, and finally we verify that statement for n. We believe the statement to be true because an exponentially growing series usually has a huge dominating last term. So indeed, the last term in an exponentially increasing sum is about the same order of magnitude as the entire sum. Telescoping Series A telescoping series is a series where each term can be expressed as a difference in such a way that most of the terms cancel each other out. This problem is motivated by the VLSI industry, where millions of VLSI chips must be tested for defaults. The idea is to let the chips test each other by built-in circuitry. Note that VLSI stands for very large scale integration which is the integrated-circuit chip technology used to fabricate most microprocessors today. Bad chips say anything about the other chip, thus cannot be trusted. Our computational model states that each chip tested counts for one time unit. This is because one good chip can identify all good chips in O time. A naive method We are going to test each chip individually by comparing it against all remaining chips. We take votes from the remaining chips and let the majority decide. If a chip is declared bad, it is junked and we continue. Divide and Conquer Paradigm Definitions : + G : set of all good chips + B : set of all bad chips + B-B : pair of chips that has been declared "bad, bad" + B-G : pair of chips that has been declared "bad, good" + G-G : pair of chips that has been declared "good, good" Here is one iteration of the divide and conquer paradigm: If n = 1 or n = 2, then return one chip (it is good). If odd chip is bad, with remaining chips do : + pair all chips + junk all B-G, B-B pairs + junk one chip of every G-G pair + find (recursively) one good chip among the remaining chips Remarks : 1. If before the iteration, |G| > |B|, then after the iteration, |G| > |B|. Each G-G pair has either two good chips or two bad ones;