Skip to main content

Posts

Showing posts from November, 2020

Binary Search

Binary Search is a method of searching an element in a sorted list of items. It follows the divide and conquer approach. The list is divided into two halves. The key(element to be searched) is compared with the middle element of list. If the element is found the index is returned, else, the element is searched in either of the sub-list until found or the last sub-list(only one element remaining) is visited.  Illustration: Algorithm: Initialize the sorted list, set low=0 and high=length(list)-1 Set mid=low+(high-low)//2 Compare key with element at mid If list[mid]==key, then return mid Else if list[mid]>key, then low=low and high=mid-1 Repeat from 2 till list[mid]=key, else return= -1 Else low=mid+1 and high=high Repeat from 2  till list[mid]=key, else return=-1 If return = -1, then print "Not found" End Time Complexity: Worst Case: O(log n)   Average Case: O(log n) Best Case: O(1) Space Complexity: O(1) Program for Binary Search

Linear Search

Linear Search is a method of searching an element in a list. It is the simplest searching algorithm in which the element is searched in a sequential manner. Each element of the data structure is compared with the key(element to be searched) in a sequential order until the element is found or the last index is visited. Illustration: Algorithm: LinearSearch(list,key)      for each_item in list          if(item==key)               return item_index      return -1 Linear Search Time Complexity: Best Case : O(1) Average Case : O(n) Worst Case : O(n) Space complexity: O(1) Program for Linear Search

Perceptron

Perceptron is a supervised learning algorithm for classification. It was originally proposed by Frank Rosenblatt and, refined and carefully analyzed by Marvin Minsky and Seymour Papert in 1969. The model is known as Perceptron Model. Implementation Code: For Notebook CLICK HERE

Machine Learning

Machine Learning is a subset of artificial intelligence which provides machine the ability to learn automatically and improve from experiences without being explicitly programmed. The concept is to make a computer learn, capable of using experiences and we need not program it again and again.  Traditional vs Machine Learning Programming In traditional programming, we provide input associated with a program and obtain output. The input is processed using the program(set of rules) we provided at input end which gives the output. We can say, it is logic driven. In Machine Learning programming, the input and output both are provided to the machine. So that, machine can learn from the dataset. Learning simply means the development of program or set of rules within itself. A machine becomes capable of processing new data using its set of rules. Steps in Machine Learning:      1. Select and prepare training dataset.      2. Choose an algorithm for training on...

AI

AI refers to Artificial Intelligence. The term was first coined in 1956 at a conference at Dartmouth University by, an American Computer and Cognitive Scientist, John McCarthy.   "AI is the Science and Engineering of making Intelligent Machines"   -John McCarthy The idea behind the study has always been to give machine the consciousness and cognitive abilities which include Learning, Understanding, Thinking and Using Experiences. These abilities are the traits of intelligence.  Major Keywords Timeline: 1943 - Warren S. McCulloch and Walter H. Pitts came up with a model of an Artificial Neuron, a Threshold Logic Unit (M-P Neuron) . 1950 - Alan Turing wrote a paper titled - "Computing Machinery and Intelligence". He proposed to consider the question "Can machines think?"   Based on the paper, Turing Test (paper stated the Imitation Game ) was invented. It is a simple method of determining whether a machine can demonstrate human intelligence i.e. Can a ma...