What does ‘predicate’ mean in the context of computer science? [duplicate]

A predicate (‘PRED-i-cat’) is the part of a sentence that contains the verb and tells you something about the subject. For instance, in the sentence “Mike is eating”, we have the subject, ‘Mike’, and the predicate, ‘is eating’. In the context of computer science, we aren’t interested in stating a fact, but rather, in testing … Read more

Does “untyped” also mean “dynamically typed” in the academic CS world?

Yes, this is standard practice in academic literature. To understand it, it helps to know that the notion of “type” was invented in the 1930s, in the context of lambda calculus (in fact, even earlier, in the context of set theory). Since then, a whole branch of computational logic has emerged that is known as … Read more

Are duplicate keys allowed in the definition of binary search trees?

Many algorithms will specify that duplicates are excluded. For example, the example algorithms in the MIT Algorithms book usually present examples without duplicates. It is fairly trivial to implement duplicates (either as a list at the node, or in one particular direction.) Most (that I’ve seen) specify left children as <= and right children as … Read more

How to determine the longest increasing subsequence using dynamic programming?

OK, I will describe first the simplest solution which is O(N^2), where N is the size of the collection. There also exists a O(N log N) solution, which I will describe also. Look here for it at the section Efficient algorithms. I will assume the indices of the array are from 0 to N – … Read more

Is there a difference between foreach and map?

Different. foreach iterates over a list and performs some operation with side effects to each list member (such as saving each one to the database for example) map iterates over a list, transforms each member of that list, and returns another list of the same size with the transformed members (such as converting a list … Read more

What’s “P=NP?”, and why is it such a famous question? [closed]

P stands for polynomial time. NP stands for non-deterministic polynomial time. Definitions: Polynomial time means that the complexity of the algorithm is O(n^k), where n is the size of your data (e. g. number of elements in a list to be sorted), and k is a constant. Complexity is time measured in the number of … Read more

What is referential transparency?

The term “referential transparency” comes from analytical philosophy, the branch of philosophy that analyzes natural language constructs, statements and arguments based on the methods of logic and mathematics. In other words, it is the closest subject outside computer science to what we call programming language semantics. The philosopher Willard Quine was responsible for initiating the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)