The stuff I've covered is actually mostly red-flags: stuff that really worries people if you don't know it. The discrete math is potentially optional, but somewhat risky if you don't know the first thing about it. Everything else I've mentioned you should know cold, and then you'll at least be prepped for the baseline interview level. It could be a lot harder than that, depending on the interviewer, or it could be easy.
#!/usr/bin/perl -w
use strict;
my @rules;
my $Expression;
my $Sentence="W=X*(Y+Z)";
my $Stack="hi";
my $i;
my $k=0;
my @rhs;
# read in grammar rules to @rules array
while(<>){
chomp;
push @rules, [split/::= /];
}
#shift first token onto stack
$Stack=substr($Sentence,$k,1);
print $Stack . "\n";
#loop which processes the entire input string until
# it has been reduced to the start token.
while($Stack!~/<Sentence>/) {
for($i=0;$i<=$#rules;$i++){
if($i!=7 && $Stack=~/$rules[$i][1]/){
#Ensures that V=E not reduced until entire string is processed
if($i!=1){
$Stack=~s/$rules[$i][1]/$rules[$i][0]/;
print $Stack . "\n";
}
elsif($i==1 && $Stack!~/\+|-|\*|\/|\(/){
$Stack=~s/$rules[$i][1]/$rules[$i][0]/;
}
}
#only allows V to be reduced if it occurs on rhs of =
elsif($i==7){
if($Stack=~/=/){
@rhs=split /=/, $Stack;
if($rhs[1]=~/($rules[7][1])/){
$rhs[1]=~s/$rules[$i][1]/$rules[$i][0]/;
print $rhs[0] ."=". $rhs[1] . "\n";
}
$Stack=$rhs[0] ."=". $rhs[1];
}
}
}
#shifts next token onto $Stack
$k=$k+1;
$Stack=$Stack . substr($Sentence,$k,1);
if($k<=8){print $Stack . "\n";}
}
print $Stack . "\n";
ITT: we all quickly copy junk that makes us look ``intelligent''.
Name:
Anonymous2008-03-15 20:31
English_
Name:
Anonymous2008-03-15 20:32
CREATE OR REPLACE FUNCTION eliminar_usuario() RETURNS TRIGGER AS $$
BEGIN
--Borra los comentarios y links de un usuario cuando se borre
DELETE FROM comentario WHERE usuarioID=OLD.usuarioID;
DELETE FROM link WHERE usuarioID=OLD.usuarioID;
--Reasignar todos los videos que tienen usuarioID en id_primer_usuario al siguiente usuario que lo agregó
FOR i IN SELECT FROM video WHERE id_primer_usuario=OLD.usuarioID LOOP
SELECT usuarioID INTO nuevoUsuarioID FROM link WHERE link.videoID=i.videoID;
UPDATE video SET id_primer_usuario=nuevoUsuarioID WHERE video.videoID=i.videoID;
END LOOP;
RETURN NULL; --Retornamos NULL para que borre, OLD para cancelar el DELETE.
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER eliminar_usuario BEFORE DELETE ON usuario FOR EACH ROW EXECUTE PROCEDURE eliminar_usuario();
Name:
Anonymous2008-03-15 20:35
>>273
You don't use English for comments and variable names. Die.
Name:
Anonymous2008-03-15 21:12
Khaimah
Name:
Anonymous2008-03-15 21:20
Ich denke,wenn jemand so stirbt,stellt man sich oft die Frage der Schuld.