The fact that over 200,000 people have downloaded one of the various “shake to charge” apps, now available from Google Play, indicates our willingness to suspend any form of practical reasoning in pursuit of the dream of wireless charging. A quick investigation of the source code would likely reveal these apps do little more than to link the interrupt signal from the accelerometer to a progress bar indicating an alleged battery charge. A Piezoelectric accelerometer could generate a small voltage secondary to deformations induced by rapid motions applied to it, however trying to use that millivolt signal to charge a battery would not be practical. In order words, shaking your smartphone isn’t going to do anything but get your arm tired.
Monday, 22 October 2012
Sunday, 21 October 2012
Recursion
Recursion
A function call is said to be recursive, if we invoke a function from within the same function. The phenomenon being referred to as recursion. A termination condition must be specified with each recursive call to avoid infinite execution of that function. Recursion is basically required whenever a function has to operate upon different set of values to obtain the result.
Evaluation of Infix expression
Application of Stacks
Evaluation of Infix expression
An infix expression is evaluated using two stacks, one for operator and another for operands. The infix sting is read in an array, from which symbols/characters are fetched one by one and the following checks are performed:
Conversion from Prefix to Infix
Application of Stacks
Conversion from Prefix to Infix
The algorithm for converting a Prefix expression to an Infix notation is as follows:
- Accept a prefix string from the user.
- Start scanning the string from right one character at a time.
- If it is an operand, push it in stack.
- If it is an operator, pop opnd1, opnd2 and concatenate them in the order (opnd1, optr, opnd2) as follows:
Conversion from Prefix to Postfix
Application of Stacks
Conversion from Prefix to Postfix
The algorithm for converting a Prefix expression to a Postfix notation is as follows:
- Accept a prefix string from the user.
- Start scanning the string from right one character at a time.
- If it is an operand, push it in stack.
- If it is an operator, pop opnd1, opnd2 and concatenate them in the order (opnd1, opnd2, optr) as follows:
Conversion from Postfix to Infix
Application of Stacks
Conversion from Postfix to Infix
The algorithm for converting a Postfix expression to Infix notation is as follows:
- Accept a postfix string from the user.
- Start scanning the string from left to right one character at a time.
- If it is an operand, push it in stack.
- If it is an operator, pop opnd2, opnd1 and concatenate them in the order (opnd1, optr, opnd2) as follows:
Conversion from Postfix to Prefix
Application of Stacks
Conversion from Postfix to Prefix
The algorithm for converting a Postfix expression to Prefix notation is as follows:
- Accept a postfix string from the user.
- Start scanning the string from left to right one character at a time.
- If it is an operand, push it in stack.
- If it is an operator, pop opnd2, opnd1 and concatenate them in the order (optr, opnd1, opnd2) as follows:
Conversion from Infix to Prefix
Application of Stacks
Conversion from Infix to Prefix
The algorithm for converting an Infix expression to Prefix is as follows:
An Infix expression is converted into Prefix using two stacks, one for operator and another for operands. The infix sting is read in an array, from which symbols/characters are fetched one by one and the following checks are performed:
Conversion from Infix to Postfix
Application of Stacks
Conversion from Infix to Postfix
The algorithm for converting an Infix expression to Postfix is as follows:
An Infix expression is converted into Postfix using two stacks, one for operator and another for operands. The infix sting is read in an array, from which symbols/characters are fetched one by one and the following checks are performed:
Saturday, 20 October 2012
Evaluation of Prefix expression
Application of Stacks
Evaluation of Prefix expression
The algorithm for evaluating a prefix expression is as follows:
- Accept a prefix string from the user.
say (-*+ABCD), let A=4, B=3, C=2, D=5
i.e. (-*+4325) is the input prefix string.
Evaluation of Postfix expression
Application of Stacks
Evaluation of Postfix expression
The algorithm for evaluating a postfix expression is as follows:
- Accept a postfix string from the user.
say (ABCD*+-), let A=4, B=3, C=2, D=5
i.e. (4325*+-) is the input postfix string.
Parenthesis checker
Application of Stacks
Parenthesis checker
It is an algorithm that confirms that the number of closing parenthesis equals opening parenthesis by using stack. If number of closing parenthesis is not equal to the number of opening parenthesis, then it results in an error. Input a string from the user. The user must enter a set of opening and closing parenthesis as follows:
Polish Notations
Polish Notations
In the early 1920s, a Polish logician, Jan Lukasiewicz invented a special notation for prepositional logic that allows to eliminate all parenthesis from formulas. The notation is called Polish Notation, which results in a less readable expression. Depending upon the arrangement of operators and operands in an expression, Polish notation may be classified as:
- Infix Polish Notation
- Prefix Polish Notation
- Postfix Polish Notation
Infix Polish Notation: In this notation, the operator comes between two operands. For example: A+B, where A, B are operands and + is an operator.
Prefix Polish Notation: In this notation, the operator comes before two operands. For example: +AB.
Postfix Polish Notation: In this notation, the operator comes after two operands. For example: AB+.
Application of Stacks:
- Parenthesis checker
- Evaluation of Postfix expression
- Evaluation of Prefix expression
- Evaluation of Infix expression
- Conversion from Infix to Postfix
- Conversion from Infix to Prefix
- Conversion from Postfix to Prefix
- Conversion from Postfix to Infix
- Conversion from Prefix to Postfix
- Conversion from Prefix to Infix
Trees
Trees
Definitions:
Binary Tree: A binary tree is either empty or it consists of a node called the root together with two binary trees called the left subtree and the right subtree of the root.
Threaded Binary Trees
Threaded Binary Trees
Threaded Binary Trees are an improvement over Binary Search Trees that uses stack for iterative traversal. If a strategy is introduced such that the leaf node of a binary search tree points to its inorder predecessor or its successor, then direct links (called threads) are obtained to traverse a tree without using stack, which basically stores and retrieves the address of nodes in LIFO manner. If the left pointer of the leaf node points to its inorder predecessor, then such a threaded tree is called Left-In-Threaded Binary Tree. If the right pointer of the leaf node points to its inorder successor, then such a threaded tree is referred to as Right-In-Threaded Binary Tree. However, if both the links, left as well as right are available, then the threaded tree is called In-Threaded Binary Tree.
Binary Search Tree
Binary Search Tree
A Binary Search Tree is a Binary Tree which satisfies the following conditions:
- The left subtree of the root contains keys smaller than the root.
- The right subtree of the root contains keys greater than the root.
- The left and right subtrees are also Binary Search Trees.
- There are no duplicates in the tree.
Circular Linked List
Circular Linked list
A circular linked list is similar to that of a singly linked list with the only difference that the last node points the first node of the list, such that a circular path is obtained. Thus last node of this list instead of pointing to NULL points to the head node as described in the following figure:-
Doubly Linked List
Representation of a doubly linked list:
A doubly linked list contains backward as well as forward reference. Each node contains two address along with the information field. One address is the address of the next node and the other one is that of the previous node. Thus doubly linked list is a bi-directional list, since we may traverse either from left to right or from right to left directly without any pointer manipulations as was the case with singly linked list.
Monday, 8 October 2012
Draft Background in Word
This trick shows you how to add a grey background text on your document.
For example, when you have a draft document, and you want to make sure
other people know it is a draft version. It is a good idea to have a
background printed text, i.e. "DRAFT" on every page of your document.
This feature is called "Watermark" in MS Word.
You can follow the same steps to create different watermarks. For example "SAMPLE", "DRAFT", "PERSONAL", or your own text.
Labels:
PC Tricks
Subscribe to:
Posts (Atom)