Saturday 8 November 2014

Parallel Distributed Processing (PDP)



Assalam and Hi to everyone, today i would like to share about Parallel Distributed Processing(PDP)
so, the drawing picture will tell you some of information about the PDP. :) 



sourse : http://www.youtube.com/watch?v=MjubRN6yL_g

Wednesday 5 November 2014

SORTING

Hye and Assalamualaikum. Today i am going to post about sorting
One of the sorting i will share here is insertion sort and buble sorting


insertion sort

-it is efficient for small number of data
-its is simple implementation and stable

code

for x=1 to n-1
       key=A[x]
       i=x-1
 while i>=0 and A[i]>key
      A[i+1] = A[i]
      i=i-1
     A[i+1]=key

bubble sorting


-bubble sorting is famous and frequently used.
-start comparing with first two array and swapping it.
-and same to others. it will continue swapping until it is arranged and sort


for i from x downto 1 {
for y from 1 to i-1{
       if (A[j]>A[j+1])
       swap(A[j],A[j+1])
}
}
}


Bubble Sort 
Java vs Python

Last semester, we are taken subject data structure with Dr. Mokhairi. We are already learn how to run bubble sort in java by using NetBeans. Since, we are learn new language Python. Let's try running bubble sort in Python Shell and making a comparison. 

Run bubble sort in Java by enter number 43,21,12,80,3,2,35:


Run bubble sort in Python by enter number 43,21,12,80,3,2,35:





Output in Java:




Output in Pyhton:



From the result above we can see clearly the differences between Java and Python. Python is more simple than Java.But it execute the same output.


Tuesday 4 November 2014

Berkeley Software Distribution


Assalamualaikum and Good Day to all. 

Berkeley Software Distribution (BSD) was a Unix operating system derivative developed and distributed by the Computer Systems Research Group (CSRG) of the University of California, Berkeley, from 1977 to 1995. Today the term "BSD" is often used non-specifically to refer to any of the BSD descendants which together form a branch of the family of Unix-like operating systems. Operating systems derived from the original BSD code remain actively developed and widely used.

The released year of BSD
1.     First Berkeley Software Distribution (1BSD), which was released on March 9, 1978.
2.     The Second Berkeley Software Distribution (2BSD), released in May, 1979.
3.     The Third Berkeley Software Distribution (3BSD), at the end of 1979.
4.     Fourth Berkeley Software Distribution (4BSD) was released in November 1980 and offered a number of enhancements over 3BSD.

What is PC-BSD?
PC-BSD® is a user friendly desktop Operating System based on FreeBSD.
Known widely for its stability and security in server environments, FreeBSD provides an excellent base on which to build a desktop operating system.
PC-BSD uses a host of popular open source window managers and uses a custom-tailored application installer that puts popular applications in easy reach of users.

Figure1 : The current stable version of the PC-BSD operating system.




A Beginner’s Guide to Big O Notation

Big O notation is used in Computer Science to describe the performance or complexity of an algorithm. Big O specifically describes the worst-case scenario, and can be used to describe the execution time required or the space used (e.g. in memory or on disk) by an algorithm.
Anyone who’s read Programming Pearls or any other Computer Science books and doesn’t have a grounding in Mathematics will have hit a wall when they reached chapters that mention O(N log N) or other seemingly crazy syntax. Hopefully this article will help you gain an understanding of the basics of Big O and Logarithms.
As a programmer first and a mathematician second (or maybe third or fourth) I found the best way to understand Big O thoroughly was to produce some examples in code. So, below are some common orders of growth along with descriptions and examples where possible.

O(1)

O(1) describes an algorithm that will always execute in the same time (or space) regardless of the size of the input data set.
bool IsFirstElementNull(String[] strings)
{
 if(strings[0] == null)
 {
  return true;
 }
 return false;
}

O(N)

O(N) describes an algorithm whose performance will grow linearly and in direct proportion to the size of the input data set. The example below also demonstrates how Big O favours the worst-case performance scenario; a matching string could be found during any iteration of the for loop and the function would return early, but Big O notation will always assume the upper limit where the algorithm will perform the maximum number of iterations.
bool ContainsValue(String[] strings, String value)
{
 for(int i = 0; i < strings.Length; i++)
 {
  if(strings[i] == value)
  {
   return true;
  }
 }
 return false;
}

O(N2)

O(N2) represents an algorithm whose performance is directly proportional to the square of the size of the input data set. This is common with algorithms that involve nested iterations over the data set. Deeper nested iterations will result in O(N3), O(N4) etc.
bool ContainsDuplicates(String[] strings)
{
 for(int i = 0; i < strings.Length; i++)
 {
  for(int j = 0; j < strings.Length; j++)
  {
   if(i == j) // Don't compare with self
   {
    continue;
   }

   if(strings[i] == strings[j])
   {
    return true;
   }
  }
 }
 return false;
}

O(2N)

O(2N) denotes an algorithm whose growth will double with each additional element in the input data set. The execution time of an O(2N) function will quickly become very large.

Logarithms

Logarithms are slightly trickier to explain so I’ll use a common example:
Binary search is a technique used to search sorted data sets. It works by selecting the middle element of the data set, essentially the median, and compares it against a target value. If the values match it will return success. If the target value is higher than the value of the probe element it will take the upper half of the data set and perform the same operation against it. Likewise, if the target value is lower than the value of the probe element it will perform the operation against the lower half. It will continue to halve the data set with each iteration until the value has been found or until it can no longer split the data set.
This type of algorithm is described as O(log N). The iterative halving of data sets described in the binary search example produces a growth curve that peaks at the beginning and slowly flattens out as the size of the data sets increase e.g. an input data set containing 10 items takes one second to complete, a data set containing 100 items takes two seconds, and a data set containing 1000 items will take three seconds. Doubling the size of the input data set has little effect on its growth as after a single iteration of the algorithm the data set will be halved and therefore on a par with an input data set half the size. This makes algorithms like binary search extremely efficient when dealing with large data sets.
http://rob-bell.net/2009/06/a-beginners-guide-to-big-o-notation/

5 differences between BSD and Linux

There are many differences between Berkeley Software Distribution (BSD) and Linux.But here, i list 5 differences show as below:


BSD
LINUX
Licenses
The BSD license does not require that you make sure the next person who uses (or modifies your code) makes that code available.

Linux operating system is licensed under The GPL gives you the right to use the software any way you want, but you MUST ensure the source code is available to the next person who uses it (or your variation of it).


Control
The BSD code is not "controlled" by any one user

Linux kernel is mostly controlled by Linus Torvalds (the creator of Linux),

UNIX-like
the BSDs are much more similar to UNIX because they are, in fact, direct derivatives of traditional UNIX.

Linux, on the other hand, was a newly created OS loosely based on a UNIX derivative (Minix, to be exact).



Kernel vs OS
The BSD project maintains the entire operating system.

The Linux project focuses primarily on the kernel alone.

Upgrades
Upgrade your entire base system to the most recent release by issuing a single command. Or you can download the sources to whatever build you want, unpack them, and build them as you would any application.

upgrade a system by using the built-in package management system. The former updates only the base system; the latter will upgrade the entire installation.


Types of Sorting Algorithm and Example.

Bucket Sort

  • Suppose we need to sort an array of positive integers {3,11,2,9,1,5}. A bucket sort works as follows: create an array of size 11. Then, go through the input array and place integer 3 into a second array at index 3, integer 11 at index 11 and so on. We will end up with a sorted list in the second array.
  • We immediately see two drawbacks to this sorting algorithm. Firstly, we must know how to handle duplicates. Secondly, we must know the maximum value in the unsorted array. Thirdly, we must have enough memory - it may be impossible to declare an array large enough on some systems.
  • The first problem is solved by using linked lists, attached to each array index. All duplicates for that bucket will be stored in the list. Another possible solution is to have a counter. As an example let us sort 3, 2, 4, 2, 3, 5. We start with an array of 5 counters set to zero.

  0    1    2    3    4    5  
 0 0 0 0 0 0
  • Moving through the array we increment counters:
  0    1    2    3    4    5  
 0 0 2 2 1 1
  • Next,we simply read off the number of each occurrence: 2 2 3 3 4 5.

Bubble Sort


  • The algorithm works by comparing each item in the list with the item next to it, and swapping them if required. The algorithm will be repeats the process until it makes a pass all the way through the list without swapping any items.

void bubbleSort(int ar[])
{
for (int i = (ar.length - 1); i >= 0; i--)
{ for (int j = 1; j ≤ i; j++) {
int temp = ar[j-1];
if (ar[j-1] > ar[j]) { ar[j-1] = ar[j];
} } } }
ar[j] = temp;
Example. 

  • Here is one step of the algorithm. The largest element - 7 - is bubbled to the top:

7, 5, 2, 4, 3, 9
5, 7, 2, 4, 3, 9
5, 2, 7, 4, 3, 9
5, 2, 4, 7, 3, 9
5, 2, 4, 3, 7, 9
5, 2, 4, 3, 7, 9

Selection Sort

  • The algorithm works by selecting the smallest unsorted item and then swapping it with the item in the next position to be filled.
  • The selection sort works as follows: you look through the entire array for the smallest element, once you find it you swap it (the smallest element) with the first element of the array. Then you look for the smallest element in the remaining array (an array without the first element) and swap it with the second element. Then you look for the smallest element in the remaining array (an array without first and second elements) and swap it with the third element, and so on. 
void selectionSort(int[] ar){
for (int i = 0; i ‹ ar.length-1; i++)
{ int min = i;
for (int j = i+1; j ‹ ar.length; j++)
if (ar[j] ‹ ar[min]) min = j; int temp = ar[i];
} }
ar[i] = ar[min];
ar[min] = temp;
Example.
29, 64, 73, 34, 20
20, 64, 73, 34, 29
20, 29, 7334, 64 
20, 29, 34, 7364 
20, 29, 34, 64, 73 

Insertion Sort

  • To sort ordered list of elements, we remove its entries one at a time and then insert each of them into a sorted part (initially empty):
void insertionSort(int[] ar)
{
for (int i=1; i ‹ ar.length; i++)
{
while (j > 0 && ar[j-1] > index)
int index = ar[i]; int j = i;
j--;
{ ar[j] = ar[j-1]; }
} }
ar[j] = index;
Example. 
  • The color a sorted part in green, and an unsorted part in black. Here is an insertion sort step by step. We take an element from unsorted part and compare it with elements in sorted part, moving form right to left.
29, 20, 73, 34, 64 
29, 20, 73, 34, 64 
20, 29, 73, 34, 64 
20, 29, 73, 34, 64 
20, 29, 34, 73, 64 
20, 29, 34, 64, 73 

Merge sort

  • Merge-sort is based on the divide-and-conquer paradigm. It involves the following three steps:
    1. Divide the array into two (or more) subarrays
    2. Sort each subarray (Conquer)
    3. Merge them into one (in a smart way!)
Example
Consider the following array of numbers
    27  10  12  25  34  16  15  31
    divide it into two parts
    27  10  12  25            34  16  15  31
    divide each part into two parts
    27  10            12  25            34  16            15  31
    divide each part into two parts
    27       10       12       25       34       16       15       31

    merge (cleverly-!) parts
    10  27            12  25            16  34            15  31
    merge parts
    10  12  25  27                 15  16  31  34
    merge parts into one
    10  12  15  16  25  27  31  34
How do we merge two sorted subarrays? We define three references at the front of each array.
We keep picking the smallest element and move it to a temporary array, incrementing the corresponding indices.




Monday 3 November 2014

ADVANTAGES AND DISADVANTAGES OF BUBBLE SORT

ADVANTAGES AND DISADVANTAGES OF BUBBLE SORT

The bubble sort algorithm works by repeatedly swapping adjacent element that are not in order until
the whole list of items in sequence.In this way,item can be seen as bubbling up the list according to their key values.

The primary advantage of the bubble sort is that it is popular and easy to implement.Moreover,in the bubble sort elements are swapped in place without using additional temporary storage,so the space requirements is at minimum.The main disadvantage of the bubble sort is the fact that it does not deal well with a list containing a huge number of items.This is because the bubble sort requires n-squared
processing steps for every n number of  elements to be sorted.Such as ,the bubble sort mostly suitable for academic teaching but not for real life applications.

CORBA


COMMON OBJECT REQUEST BROKER ARCHITECTURE








CORBA


CORBA Data Flow


ORB :

  • find the object implementation for the request,prepare the object implementation to receive the request and communicate the data making up the request.
  • ORB throws exception
Object Implementation :
  • provides ORB services to particular groups of object implementations.
IIOP : Internet Inter-ORB Protocol
  • TCP/IP implementation of GIOP

Resources :
http://www.cs.rpi.edu/courses/fall02/netprog/notes/javacorba/javacorba.pdf

Cognitive Psychology


I read an article regarding cognitive psychology in which it relates the human mind to computer processing. It sparks my interest because for a moment, it is not completely off topic and kind of interesting. 

The term "Cognitive Psychology" refers to the study of mental processes such as attention, language use, memory, perception, problem solving, creativity, and thinking.

The individual or the human brain itself is a processor of information, the same as how we see computer takes in information(input) and follows a program(process) to produce an output.


cognitive psychology sub-topics

THEORETICAL

Based on further studies, several theory are written.
  • Information made available by the environment is processed by a series of processing systems (e.g. attention, perception, short-term memory)
  • These processing systems transform or alter the information in systematic ways
  • The aim of research is to specify the processes and structures that underlie cognitive performance
  • Information processing in humans resembles that in computers


COMPUTER - MIND ANALOGY


computer brain metaphor
Cognitive psychologists describes the computer as an analogy to compare human mental processing. The computer analogy is the use of the computer as a tool for thinking how the human mind handles information.

The information processing approach characterizes thinking as the environment providing input of data, which is then transformed by our senses. The information can be stored, retrieved and transformed using “mental programs” with the results being behavioral responses.

Critical Evaluation

A number of models of attention within the Information Processing framework have been proposed including:
Broadbent's Filter Model (1958), Treisman's Attenuation Model (1964) and Deutsch and Deustsch's Late Selection Model (1963).
  • The information processing models assume serial processing of stimulus inputs.
    Serial processing effectively means one process has to be completed before the next starts.
    Parallel processing assumes some or all processes involved in a cognitive task(s) occur at the same time
  • The analogy between human cognition and computer functioning adopted by the information processing approach is limited. Computers can be regarded as information processing systems insofar as they:
    (i) combine information presented with stored information to provide solutions to a variety of problems
    (ii) most computers have a central processor of limited capacity and it is usually assumed that capacity limitations affect the human attentional system
  • The evidence for the theories/models of attention which come under the information processing approach is largely based on experiments under controlled, scientific conditions. Most laboratory studies are artificial and could be said to lack ecological validity
  • The Models proposed by Broadbent and Treisman are 'bottom-up' or ‘stimulus driven’ models of attention. Although it is agreed that stimulus driven information in cognition is important, what the individual brings to the task in terms of expectations/past experiences are also important. These influences are known as 'top-down' or 'conceptually-driven' processes
References : http://www.simplypsychology.org/information-processing.html


CORBA Reference Model Architecture


  • The CORBA standard relies on a reference model named the OBject Management Archtecture (OMA)
A typical CORBA implementations includes:
  • An object Request Broker (ORB) implementations
  • An interface Definition Language (IDL) compiler
  • Implementations of Common Object Service (COS) also called CORBA services
  • Common Framework, also called CORBA facilities
  • An internet Inter ORB Protocol (IIOP) implementation

Hyper-threading Technology's Benefits and Drawbacks


Assalamualaikum. Here, I would like to share the advantages and disadvantages of hyper-threading technology.



References:1.http://www.windowsnetworking.com/articles-tutorials/netgeneral/Intels-Hyper-Threading-Technology.html
                   2.http://en.wikipedia.org/wiki/Hyper-threading
                   3.http://www.slideshare.net/ankita_mistry/hyper-threading-13849335?related=4