Tutorial by Examples: bi

Consider the Binary Tree: Pre-order traversal(root) is traversing the node then left sub-tree of the node and then the right sub-tree of the node. So the pre-order traversal of above tree will be: 1 2 4 5 3 6 7 In-order traversal(root) is traversing the left sub-tree of the node then the node ...
For example if the inputs are: Example:1 a) b) Output should be true. Example:2 If the inputs are: a) b) Output should be false. Pseudo code for the same: boolean sameTree(node root1, node root2){ if(root1 == NULL && root2 == NULL) return true; if(root1 == NULL ...
P( glasses | reading ) = Count( reading glasses ) / Count( reading ) We count the sequences reading glasses and glasses from corpus and compute the probability.
function getCombinations(params, combinationsResults){ if(params.length == 0) return combinationsResults; var head = params[0]; var tail = params.slice(1); var combinationsResultsCurrent = []; if(Array.isArray(head)){ _.uniq(head).forEach(function(item){ ...
The latest find is always the one the availability check will work against - a unsuccesful find will make AVAILABLE return false: DEFINE TEMP-TABLE tt NO-UNDO FIELD nr AS INTEGER. CREATE tt. tt.nr = 1. CREATE tt. tt.nr = 2. CREATE tt. tt.nr = 3. DISPLAY AVAILABL tt. // yes (tt w...
The BigDecimal class contains an internal cache of frequently used numbers e.g. 0 to 10. The BigDecimal.valueOf() methods are provided in preference to constructors with similar type parameters i.e. in the below example a is preferred to b. BigDecimal a = BigDecimal.valueOf(10L); //Returns cached O...
BigDecimal provides static properties for the numbers zero, one and ten. It's good practise to use these instead of using the actual numbers: BigDecimal.ZERO BigDecimal.ONE BigDecimal.TEN By using the static properties, you avoid an unnecessary instantiation, also you've got a literal in you...
TypeScript enables editors to provide contextual documentation: You'll never forget whether String.prototype.slice takes (start, stop) or (start, length) again!
How to ... 1 - use twig extension class that extends use \Twig_Extension class dobToAge extends \Twig_Extension { 2 - Add the appropriate filter by overriding getFilters() method public function getFilters() { return array( 'age' => new \Twig_Filter_Method($this, '...
Go to Xcode and open your project. In your app target, navigate to Capabilities tab. Turn on Background Modes.
bindings: { mandatory: '=' optional: '=?', foo: '=?bar' } Optional attributes should be marked with question mark: =? or =?bar. It is protection for ($compile:nonassign) exception.
In traditional object-oriented languages, x = x + 1 is a simple and legal expression. But in Functional Programming, it's illegal. Variables don't exist in Functional Programming. Stored values are still called variables only because of history. In fact, they are constants. Once x takes a value, it...
Let's assume you have a ListView wich is supposed to display every User object listed under the Users Property of the ViewModel where Properties of the User object can get updated programatically. <ListView ItemsSource="{Binding Path=Users}" > <ListView.ItemTemplate> ...
With turbolinks, the traditional approach to using: $(document).ready(function() { // awesome code }); won't work. While using turbolinks, the $(document).ready() event will only fire once: on the initial page load. From that point on, whenever a user clicks a link on your website, turbolink...
Since 1.7 there's a java.util.BitSet class that provides simple and user-friendly bit storage and manipulation interface: final BitSet bitSet = new BitSet(8); // by default all bits are unset IntStream.range(0, 8).filter(i -> i % 2 == 0).forEach(bitSet::set); // {0, 2, 4, 6} bitSet.set(3);...
You can bind the callback function. new Vue({ el:"#star-wars-people", data:{ people: null }, mounted:function(){ $.getJSON("http://swapi.co/api/people/", function(data){ this.people = data.results; }.bind(this)); } })
You can combine mulple layout thanks to other QWidgets in your main layout to do more specifics effects like an information field: for example: #include <QApplication> #include <QMainWindow> #include <QWidget> #include <QVBoxLayout> #include <QPushButton> #inclu...
A frequent question about StackViews inside Scrollviews comes from ambiguous with/heigh alerts on interface builder. As this answer explained, it is necessary to: Add in the UIScrollView a UIView (the contentScrollView); In this contentScrollView, set top, bottom, left and right margins to 0 Se...
To extend and expand upon the binding experience we have converters to convert one a value of one type into another value of another type. To leverage Converters in a Databinding you first need to create a DataConverter class tht extens either IValueConverter(WPF & UWP) or IMultiVal...

Page 25 of 29