Search Results


6 matches found for 'negation'

Forall and Exists in Scala

... // Keep looping } iter(bound) } Note that the negation of !p(a) is simply p(a). And there you have it. We now have the exists function.


Cyclic Permutation

This is an array/list trick that saves about O(n) in space complexity by taking advantage of a given array with integers representing indices. For this example problem, suppose that we want to apply some permutation P to an array A.


Machine Learning Basics

Supervised Learning In supervised learning, we take some data and predict an output in a pre-defined structure. There are two categories: Regression: When a function is given some input variables, what is the continuous output? i.


A quick look at Scala and the syntax

The syntax in Scala can look confusing very fast.. def exists(s: Set, p: Int => Boolean): Boolean = !forall(s, (x: Int) => !p(x)) p here is a function parameter; okay, I get that. p: Int => Boolean means that this function takes an Int parameter and returns a Boolean at the end.


Counting the path of sums

Description Given a binary tree with nodes containing integer values (positive or negative), how can you count up all the paths that equal to some target sum? Note, that the paths do not have to start from the root; it may start from any sub-tree and end at another sub-tree, as long as the path goes down the tree.


CSR vs. SSR

Introduction 10 years ago, Amazon found that every 100ms of latency cost them 1% in sales. Google found an extra .5 seconds in search page generation time dropped traffic by 20%. A broker could lose $4 million in revenues per millisecond if their electronic trading platform is 5 milliseconds behind the competition.