What does ' (single quotes) means in pseudocode - pseudocode

I was reading lecture about Greedy Strategies for Interval Scheduling
and i came across this symbol S
′
←∅. I have no idea what it means. does anyone know?

S′ is just the name of a variable. It is read as "S prime". So the code S′ ←∅ sets the variable S′ equal to an empty set.

That's not "S quote" -- it's "S prime". It is standard mathematical notation to use the "prime" symbol to indicate something that is related to or derived from something else.
So in this case, the variable "S prime" is a variable that is derived from "S".

Related

Relational algebra, without use of division operator

Given :
PROFESSOR(NAME,OFFICE,DEPARTMENT,AGE)
COURSE(CNO,TITLE,DEPARTMENT)
ENROLL(CNO,SEMESTER,INSTRUCTOR_NAME,ENROLLMENT)
Find names of professors who taught all the courses in their department. Your solution must not use the division operator.
Is this question solvable using relational algebra?
I feel that this is not possible, even with the use of division operator. Unless we do it repeatedly for each professor name or for a particular department.
Any great ideas?
Is this question solvable using relational algebra?
Yes, it is. "All" is a clue to consider relational division.
But relational division is not a primitive operator. So you can "use" it without using it by using the operators by which it can be defined. There are many sources for learning about "all" and division queries.
(The conditions for tuples to be returned for "all the" and "at least the" queries, including those for which division is and is not appropriate, involve using the formal "forall X" and "not exists X". And "and not" leads to algebraic "minus" while "exists X" leads to algebraic "project all attributes but X". And often is is simpler to reason about such conditions using relational subset-of: A first relation is a subset of a second when the tuple membership condition for the first implies the tuple membership condition for the second. And "P implies Q" means "not (P and not Q)". In which "and not" turns up again.)

Conceptual issue occurred while converting infix notation to postfix notation

How can I realize/understand what is the preferential order/precedence of operators while converting infix notation to postfix notation :
" * ", " / ", " + ", " - ", " ^ ", " ) ", " ( ".
I understand that one can just look at an algorithm for this and solve this but I don't want to do that. What should be my thought process?
Operator precedence is a convention and property of a formal infix language to indicate which operations should evaluate first. A higher precedence operation means that it should operate before lower precedence operations.
Grouping parentheses are not part of the operator precedence. (Note that other kinds of parentheses such as function call parentheses may be however I am assuming you do not refer to those here) They are used to explicitly indicate the order of operations. Parentheses are only useful to indicate an order of operations in infix notation. The purpose of the operator precedence convention in a given language is to avoid using parentheses in most case. So, for example, if I want to multiply 4 by 5 and then add 7 to the result, I can write:
4*5+7
This is valid under normal arithmetic operator precedence rules because multiplication ('*') has higher precedence than addition ('+'). But if I want to add 3 and 4 and then multiply this result by 8, I need to write:
(3+4)*8
In this case I want the order of operations to be different than the normal order of "higher precedence operations first." In other words, parenthesis are only necessary when we are using infix notation and want operations to execute in an order other than precedence-order.
In standard arithmetic, exponentiation ("^") has highest precedence. Next is multiplication and division (equal precedence) and finally addition and subtraction. Therefore, an infix expression written using these operators without parenthesis will evaluate all exponentiation first, then all multiplications and divisions (in left to right order) and finally all additions and subtractions, again in left to right order.
If you want to infer the operator precedence of an unknown language, you would need to look at the places where parentheses are and are not used. Since it is valid to use parentheses everywhere even when unnecessary, this is only a heuristic. For the examples above, I can write:
((4*5)+7)
And this gives no hint about operator precedence. It is because every binary operator in this case has parentheses, and therefore at least one of the two sets is redundant assuming the precedence of addition and multiplication are not the same.
Similarly, looking at the next example:
(3+4)*8
since parentheses were used around the addition but not the multiplication, we can infer that probably in this language addition has lower precedence than multiplication. Otherwise, the parenthesis would be redundant. So look for the pattern where parentheses are and are not used to try to figure out operator precedence in unknown languages. It is more common to assume a certain precedence level based on the formal specification of the language under consideration. Most formal languages have an operator precedence chart for the infix form to avoid this ambiguity.
We never need parentheses in prefix or postfix languages because the order of terms and operators already makes the order of evaluation explicit. Therefore this issue is really an infix-language-specific problem.
If parentheses are balanced properly you can always find a parenthesis-free subexpression, which reduces the problem to that case.
Now just ask yourself, according to precedence rules, which operation in such an expression should be performed first?

meaning of circumflex in algorithm description

I try to find out how to interpret/read the circumflex in this algorithm description:
http://fourier.eng.hmc.edu/e161/lectures/morphology/node2.html
"3: Mark all pixels satisfying the following:"
Also it is unclear to me what the caron(s) after "above can be represented by:" mean.
I know that in some languages the circumflex/caret means "logical or" and sometimes "exclusive or" and caron "logical and".
How are those read in a general algorithm description like in the example?
The symbol ∧ means AND. All of the clauses in the expression have to be true in order for the expression to be true.
http://en.wikipedia.org/wiki/Logical_conjunction
The symbol ∨ means OR. At least one clause has to be true in order for the expression to be true.
http://en.wikipedia.org/wiki/Logical_disjunction
You may be interested in this comprehensive table of logic symbols:
http://en.wikipedia.org/wiki/List_of_logic_symbols

Manually evaluating logical expressions

I'm not sure if this belongs here, but I was told to evaluate
(00110101 ^ (10010101 v 10100000))
How is my answer suppose to look like?
I was wondering how I would do this?
I'm thinking of treating each of those values as a variable like (a ^ (b v c))
then make a truth table? Is that what I'm suppose to do?
Do the stuff in the parentheses first:
10010101
| 10100000
-----------
101.....
Then AND the result with the first number:
00110101
& 101.....
-----------
001.....
For bitwise logic simply evaluate each expression bit-by-bit. Take the first bit of expressions b and c and OR them, then AND them with the first bit of a. Then move to the second bit, etc. You should end up with a bit string of equal length as the starting strings.

OTTER inferences

I'm writing an input file for OTTER that is very simple:
set(auto).
formula_list(usable).
all x y ([Nipah(x) & Encephalitis(y)] -> Causes(x,y)).
exists x y (Nipah(x) & Encephalitis(y)).
end_of_list.
I get this output for the search :
given clause #1: (wt=2) 2 [] Nipah($c2).
given clause #2: (wt=2) 2 [] Encephalitis($c1).
search stopped because sos empty
Why won't OTTER infer Causes($c2,$c1)?
EDIT:
I removed the square brackets from [Nipah(x) & Encephalitis(x)] and it worked. Why does this matter?
I'd answer with a question: Why did you use square brackets in the first place?
Look into Otter manual, Section 4.3, List Notation. Square brackets are used for lists, it's syntactic sugar that is expanded into special terms. In your case, it expanded to something like
all x y ($cons(Nipah(x) & Encephalitis(y), $nil) -> Causes(x,y)).
Why won't OTTER infer Causes($c2,$c1)?
Note that the resolution calculus is not complete in the sense that every formula provable in a given theory could be inferred by the calculus. This would be highly undesirable! Instead, resolution is only refutationally complete, meaning that if a given theory is
contradictory then the resolution will find a proof of the empty clause. So even if a clause C is a logical consequence of a set of clauses T, it doesn't mean that the resolution calculus can derive C from T. In your case, the fact that Causes($c2,$c1) follows from the input doesn't mean Otter has to derive it.

Resources