Monday, October 31, 2005
Memoization Rocks
//
#include "iostream"
using namespace std;
int results[50];
long memoized_fibonacci_recurs(int results[],int n) {
long val = 0;
if (results[n] != -1)
return results[n];
if (n == 1)
val = 1;
else if (n == 2)
val = 1;
else {
val = memoized_fibonacci_recurs(results,n - 2);
val = val + memoized_fibonacci_recurs(results,n - 1);
}
results[n] = val;
return val;
}
long fib(int num)
{
if ( num == 0 )
return 0;
if ( num == 1)
return 1;
else
return (fib(num-1) + fib(num-2));
}
long memoized_fibonacci(int n) {
for(int i = 0; i < 50; i++)
results[i] = -1; // -1 means undefined
return memoized_fibonacci_recurs(results,n);
}
int main(int argc, char*argv[])
{
long num = fib(40);
long num1 = memoized_fibonacci(40);
cout << "Computed Value is:" << num << endl;
cout << "Memoized Computed Value is:" << num1 << endl;
}
Wednesday, October 26, 2005
Maximum Likelihood
Let X=( ) be a random vector and
When there is no confusion, is abbreviated to be
.
The parameter vector such that
for all
is called a maximum likelihood estimate, or MLE, of
.
Monday, October 24, 2005
Standard Deviation
Suppose we are given a population x1, ..., xN of values (which are real numbers). The arithmetic mean of this population is defined ashttp://en.wikipedia.org/wiki/Standard_deviation For formulaes
Monday, October 17, 2005
Probability Distribution function
Analogy: For e.g while tossing a dice we are not interested in the actual outcomes but are interested in the functions of the outcome
A random variable that can take at most a countable number of possible values is said to be discrete. For discrete random variable we define probability mass function
Picked from lecture notes :) for my reference ( thanks to whoever did it)
Cumulative Distributive function
--------------------------------------
What is the probability that x is less than or equal to x0?
The probability that x < x="-" infinity="" integral="" x0="" dx="">
This integral yields the area under the curve between x = -∞ and x = x0
and is called the cumulative density function or cdf denoted by ‘g’.
Covariance Properties
---------------------------------
Analysis Server Database Backups
Dunno what i wrote :)
-Kalyan
Monday, September 26, 2005
Mantis Bug Tracking System
Mantis and this seems pretty interesting bugtracking system with minimal overheads of installation so that is what I thought.
Some of the issues that I ran into
1. Bug database installed into other system ( so I had to add this user to the database giving this user access to this database , like
GRANT ALL PRIVILEGES ON.* TO 'monty'@'machinename' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
2. PHP captcha problem , so had to comment that part of code,
tried playing around with the captcha code but seems to fail on all occassions.
-Kalyan
Wednesday, September 21, 2005
Interfaces in C#
interface Itest
{
void show();
}
class cl:Itest
{
void show()
{
}
}
Throws an error saying that the show must be either public, static. Trying to find out what is the default scope of the members in C#.
Assemblies decide the scope of the class not namespace, sounds funny as to why anyone would do that as to decide the scope based on the assembly and not on the namespace.
Investigating further
-Kalyan
Friday, September 09, 2005
Big Oh notation
Sometimes, it is very necessary to compare the order of some common used functions including the following:
| 1 | logn | n | nlogn | n2 | 2n | n! | nn |
Now, we can use what we've learned above about the concept of big-Oh and the calculation methods to calculate the order of these functions. The result shows that each function in the above list is big-oh of the functions following them. The figure below displays the graphs of these funcions, using a scale for the values of the functions that doubles for each successive marking on the graph.
Wednesday, August 24, 2005
Recursion
------------
1. Binary Search
2. Permutation
3. Combination
4. Telephone words
-Kalyan
Friday, August 19, 2005
Condor Project
http://www.cs.wisc.edu/condor/
High throughput computing
- Develop
-Implement
-Deploy
Specialized workload management system for computer intersive jobs.
Condor provides
- a job queuing system
- scheduling policy
- priority scheme
- resource monitoring
- resource management
Users submit their serial or parallel jobs to Condor, Condor places them into a queue, chooses when and where to run the jobs based upon a policy, carefully monitors their progress, and ultimately informs the user upon completion.
Similar to batch queueing system. Condor can be used to seamlessly combine all of an organization's computational power into one resource.
Condor provides high throughput
- Available resources more efficient. (That is resource usage more efficient)
- Expands the resources availabe to users.
Thursday, August 18, 2005
What is a Random Variable?
The outcome of an experiment need not be a number, for example, the outcome when a coin is tossed can be 'heads' or 'tails'. However, we often want to represent outcomes as numbers. A random variable is a function that associates a unique numerical value with every outcome of an experiment. The value of the random variable will vary from trial to trial as the experiment is repeated.
There are two types of random variable - discrete and continuous.
A random variable has either an associated probability distribution (discrete random variable) or probability density function (continuous random variable).
Examples
- A coin is tossed ten times. The random variable X is the number of tails that are noted. X can only take the values 0, 1, ..., 10, so X is a discrete random variable.
- A light bulb is burned until it burns out. The random variable Y is its lifetime in hours. Y can take any positive real value, so Y is a continuous random variable.
The probability distribution of a discrete random variable is a list of probabilities associated with each of its possible values. It is also sometimes called the probability function or the probability mass function.
- More formally, the probability distribution of a discrete random variable X is a function which gives the probability p(xi) that the random variable equals xi, for each value xi: p(xi) = P(X=xi)
It satisfies the following conditions:
Cumulative Distribution Function
All random variables (discrete and continuous) have a cumulative distribution function. It is a function giving the probability that the random variable X is less than or equal to x, for every value x.
- Formally, the cumulative distribution function F(x) is defined to be:
- for
For a discrete random variable, the cumulative distribution function is found by summing up the probabilities as in the example below.
For a continuous random variable, the cumulative distribution function is the integral of its probability density function.
- Example
- Discrete case : Suppose a random variable X has the following probability distribution p(xi):
xi 0 1 2 3 4 5 p(xi) 1/32 5/32 10/32 10/32 5/32 1/32 - This is actually a binomial distribution: Bi(5, 0.5) or B(5, 0.5). The cumulative distribution function F(x) is then:
xi 0 1 2 3 4 5 F(xi) 1/32 6/32 16/32 26/32 31/32 32/32 - F(x) does not change at intermediate values. For example:
- F(1.3) = F(1) = 6/32
- F(2.86) = F(2) = 16/32
Tuesday, August 16, 2005
SQLPLUS formatting
set recsep off
set linesize 100
set newpage 0
set pagesize 999
column famname format a15
column rufname format a10
column gebdat format a10
select famname, rufname, gebdat, om from e01e001 where...
FAMNAME RUFNAME GEBDAT OM
-------------- ---------- ---------- ----------
Lippmann Richard 09.07.1966 12
Meier Luise 01.01.1834 13
-Kalyan
Oracle Tablespace usage query
select tablespace_name, owner, sum(bytes)/1024/1024 Mb
from dba_segments
where owner not in ('SYS','SYSTEM')
group by tablespace_name, owner
order by 3
http://www.blacksheepnetworks.com/security/resources/www.think-forward.com/sql/du.htm
A good reference for sqlplus
http://www.psoug.org/reference/sqlplus.html
-Kalyan
Monday, August 15, 2005
THE X Window System
Wikipedia site are good references for this
-Kalyan
Wednesday, August 10, 2005
Perl Tricks
The code:
BEGIN{unshift @INC, "/tmp"} can be replaced with the more elegant:
use lib "/tmp"; Which is almost equivalent to our BEGIN block and is the recommended approach.
@alphabet_array = ('a' .. 'z');
-kalyan
Tuesday, August 09, 2005
/etc/shadow file structure
smithj:Ep6mckrOLChF.:10063:0:99999:7:::
As with the passwd file, each field in the shadow file is also separated with ":" colon characters, and are as follows:
Username, up to 8 characters. Case-sensitive, usually all lowercase. A direct match to the username in the /etc/passwd file.
Password, 13 character encrypted. A blank entry (eg. ::) indicates a password is not required to log in (usually a bad idea), and a ``*'' entry (eg. :*:) indicates the account has been disabled.
The number of days (since January 1, 1970) since the password was last changed.
The number of days before password may be changed (0 indicates it may be changed at any time)
The number of days after which password must be changed (99999 indicates user can keep his or her password unchanged for many, many years)
The number of days to warn user of an expiring password (7 for a full week)
The number of days after password expires that account is disabled
The number of days since January 1, 1970 that an account has been disabled
A reserved field for possible future use