Skip to main content

Posts

Relevant Course / Subjects to Artificial Intelligence

Philosophy :  Logic, methods of reasoning, mind as physical system, foundations of learning, language, rationality. Mathematics:  Formal representation and proof, algorithms, computation, (un)decidability, (in)tractability Probability/Statistics:  Modeling uncertainty, learning from data Economics:  Utility, decision theory, rational economic agents Neuroscience:   Neurons as information processing units. Psychology/  Cognitive Science:   How do people behave, perceive, process cognitive information,  represent knowledge.               Computer engineering:  Building fast computers  Control theory:  Design systems that maximize an objective function over time Linguistics:  Knowledge representation, grammars. 
Recent posts

Intelligence and Artificial Intelligence, what is it?

What is artificial intelligence? Artificial intelligence is the intelligence of machines and robots and the branch of computer science that aims to create it. -  Wikipedia . It is the science and engineering of making intelligent machines, especially intelligent computer programs. It is related to the similar task of using computers to understand human intelligence, but AI does not have to confine itself to methods that are biologically observable. What is intelligence?  “the capacity to learn and solve problems” (Websters dictionary) In particular,  the ability to solve novel problems  the ability to act rationally  the ability to act like humans refere to AI.   Intelligence is the computational part of the ability to achieve goals in the world. Varying kinds and degrees of intelligence occur in people, many animals and some machines.

Knapsack Algorithm Shortcut Method

The knapsack problem or rucksack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. It derives its name from the problem faced by someone who is constrained by a fixed-size knapsack and must fill it with the most valuable items. The main goal of Knapsack  is: You have a knapsack that has capacity (weight) W. You have several items I1,…,In. Each item Ij has a weight wj and a benefit bj.You want to place a certain number of copies of each item Ij in the knapsack so that: The knapsack weight capacity is not exceeded and The total benefit is maximal. There is a Shortcut Method  for Knapsack Algorithm , see the video:  

Java Program for finding Palindrome

Just follow the program to find Palindrome  in java: import java.io.BufferedReader; import java.io.InputStreamReader; public class Palindrome {     public static void main(String[] args) throws Exception {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));      String s1 = new String();          s1 =br.readLine();          s1 = s1.toLowerCase();     String s2 = new StringBuffer(s1).reverse().toString();          if(s1.equals(s2)){         System.out.println("Palindrome");     }else          System.out.println("Not Palindrome");      } }

Read or input form user in Java using BufferedReader

 BufferedReader use to read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.The buffer size may be specified, or the default size may be used. The default is large enough for most purposes. In Java  BufferedReader is a efficient method to read an input. Here given a short example to read a string from user and print it: package palindrome; import java.io.BufferedReader; import java.io.InputStreamReader; public class  inputExample   {     public static void main(String[] args) throws Exception {    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));     String s = new String();       s =br.readLine();     System.out.println(s);     } }

Difference between Scanner vs. BufferedReader

BufferedReader Read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. The buffer size may be specified, or the default size may be used. The default is large enough for most purposes. Where Scanner is a simple text scanner which can parse primitive types and strings using regular expressions. A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace. The resulting tokens may then be converted into values of different types using the various next methods. Scanner is used for parsing tokens from the contents of the stream while BufferedReader just reads the stream and does not do any special parsing. In currently latest JDK6 release/build, the Scanner has a littler buffer (1KB char buffer) as opposed to the BufferedReader (8KB byte buffer), but it's more than enough.As to the choice, use the Scanner if you want to parse the file, use the Buffered

Difference Between Function and Method

Each language has its own lexicon of terms with special meaning. In C Programming Language, the word Function means a program routine. In Java, the term Function does not have any special meaning. Whereas Method means one of the routines that forms the implementation of a class. First let we know what is Function? A function is a piece of reuseable code that is called by name. In C or C++ we used to say function to a reusable code. It can be passed data to operate on (arguments / parameters) and can optionally return a result. Function is a portion of code within a larger program, which performs a specific task and is relatively independent of the remaining code. So What is Method?? A method  is a piece of code that is called by name that is associated with an object. A method is almost identical to a function but it's purpose is generally to operate on the data contained within the component (class). Method is a function that is a member of a class. If you know