Linear Search v/s Bisection (Binary) Search




Linear Search:
  • It is a sequential search over a list.
  • A simple searching technique.
  • Used when elements in the list are Unsorted. 
  • Its not efficient. (Efficiency discussed below) 

Finding Square Root: Examples of Guess & Check Algorithm




"Guess and Check" - The phrase itself says that we will guess the answer and check, if condition is satisfied, that guess is our answer, else iterate.

An example for this can be, lets say we want to find square root of any perfect square.

Iteration or Looping




Iteration:
Iteration, Repetition, Looping
  • Start with a test
  • If evaluates to True, then execute loop body once, and go back to reevaluate the test
  • Repeat until test evaluates to False, after which code following iteration statement is executed

Branching Program: Using if, if else, nested if else, elif in Python




Branching programs

The simplest branching statement is a conditon
How to use if else, elif
  • A test (expression that evaluates to True or False) 
  • A block of code to execute
  • if the test is True!
  • An optional block of code to execute if the test is False!

Operations on String & some Simple Program Scripts




How to declare a string:

>>> myString = "We are learning" #double quotes are necessary
>>> myStr2 = 'Python' #even a single quote can be used
>>> print myString #print a Python in-built function
We are learning
>>> myString
'We are learning' #single quote indicates that variable myString is a string
>>> myStr2
'Python'

Core Elements of Program: Compilation, Interpretation, Objects, Type Casting




For a code to run on your machine, machine should first understand the code and run the script accordingly.

There are two options for modern high level programming languages. A compiled language or an interpreted language.

Syntax, Static Semantics, Semantics of a Language




As the title suggests 'Learning Python' & also MIT's 6.00x course's Revision, we hereby will go through every aspect of the course as quickly as possible along with some frequently used Python tools.

I take this opportunity as a part of the Final Exam preparation. So we'll include all exam oriented points from the courseware. Best way to revise is to recall examples rather than going through all theory stuff.

Here we go.