Welcome To baselogics.blogspot.in

Welcome to baselogics.blogspot.com

Place to Learn Programmes.

Bits and Bytes....

Computer Scientists Love Their Algorithms and Data Structures

Explore all new Mathematical Puzzles......

Jasper Roberts - Blog

Sunday, September 28, 2014

Linux, The Powerful Optimized Operating System......................

Do you Know How Linux is Built ?
Knowingly or unknowingly , You use linux .
Developers across the world submit their source code and Get Paid if selected For linux.
You Wait for year to see new Windows or ios but , New Linux  Kernel is Produced Every 3 months.
 Isn't this sounds really Great ?    Presently the Progress rate of linux is Simply Unmatched.
The Most Successful Open source Software Company is Ready To the World of Computing....
 Want to make most of your old low configuration PC ? Surely the only way to do this is installing Linux Operating System.
Nowadays the android phone which are beating the market of windows or java which is outdated now uses Linux Source Code to perform Faster >>>>>>>>>>>>>>>>>>>>>>
       source: Linux Foundation, YouTube

Tuesday, September 23, 2014

How to use laptop Wi-Fi to connect to internet for Hacking hotspot via kali linux or on any other os.............

 Hello friends!!!!!
This Post is Related to Problem with vmware for connecting over Wi-Fi connection For Hacking or Surfing purpose........

Because We Know that
follow the simple steps:

1. open networks and sharing settings
2. ensure WiFi is connected in physical os
3. click on WiFi adapter
4. then click on properties
5. then go to sharing tab
6. click on share this connection through host
7. here you have to select the default ethernet
   connection.(name may be different depending
   on your OS) mine is simply ethernet
8. now go to vmware
9. open settings under VM tab
10.now click on networks adapter
11.on R.H.S. network connection should be on
    NAT:used to share host IP.
12.click ok and enjoy surfing with wifi in
   VMWARE OS.  

Very IMP :Don't Forget to restore sharing settings on wi-fi properties to default when  you  done using with the wifi in vmware.

In the same way you can do it to any os simply go to os
and check as NAT Connection.

You Can Also follow it by simple video.
Don't forget to enter proxy for connecting to internet in Virtual Machine. 



Wednesday, September 10, 2014

Data Structures and Programming

In algorithmic problem solving, we deal with objects.  Objects are data manipulated by the algorithm.  To a cook, the objects are the various types of vegetables, meat and sauce.  In algorithms, the data are numbers, words, lists, files, and so on.  In solving a geometry problem, the data can be the length of a rectangle, the area of a circle, etc.  Algorithm provides the logic; data provide the values.  They go hand in hand.  Hence, we have this great truth:
Program = Algorithm + Data Structures
 Data structures refer to the types of data used and how the data are organised in the program.  Data come in different forms and types.  Most programming languages provides simple data types such as integers, real numbers and characters, and more complex data structures such as arrays, records and files which are collections of data.  Because algorithm manipulates data, we need to store the data objects into variables, and give these variables names for reference.  For example, in mathematics, we call the area of a circle A, and express A in terms of the radius r.  (In programming, we would use more telling variable names such as area and radius instead of A and r in general, for the sake of readability.)  When the program is run, each variable occupies some memory location(s), whose size depends on the data type of the variable, to hold its value. 

Sunday, September 7, 2014

Tutorial on How to Create Simple Website using html for the beginners.................

This tutorial is made keeping the state of beginner to be zero knowledge about the html language....................

Get the list with syntax of html tags on http;\\w3schools.com\

Saturday, September 6, 2014

Fibbonacci series Algorithm with Flowchart

              We all know fibbonacci sequence (for eg 1,1,2,3,5,8,13,....  sequence in which next no is addition of previous 2 fibonacci numbers) so we will try to write algorithm to generate fibbonacci sequence . 
F1=1st number, F2=2nd number -->F3=f1+f2=1+2=3 F4=f2+f3=2+3=5 F5=f3+f4=3+5=8, and so on. f1 f2 f3 f4 f5 f6 f7.............. 1 2 3 5 8 13 21............. 
In algorithm: 
1. Assign sum=0, A=0, B=1, i=1 
2. Get the no. of terms upto which u want to generate the Fibonacci no, i.e., n. 
3.Add A and B to get the next Fibonacci number 
4. Assign the value of B to A i.e. A=B 
5. Assign the value of sum to B i.e. B=sum 
6. Write the value of su to get next Fibonacci number in the series. 
7. increment i with 1 i.e. i=i+1 and repeat step 3,4,5,6 with the last value of i=n(n is the no. of terms which u wnt to generate Fibonacci no. series.) 
8. Stop
















Thursday, September 4, 2014

What Kinds of problems are solved by algorithm ?

Sorting is by no means the only computational problem for which algorithms have been developed. (You probably suspected as much when you saw the size of this book.) Practical applications of algorithms are ubiquitous and include the following examples:

  • The Human Genome Project has made great progress toward the goals of identifying all the 100,000 genes in human DNA, determining the sequences of the 3 billion chemical base pairs that make up human DNA, storing this information in databases, and developing tools for data analysis. Each of these steps requires sophisticated algorithms. Although the solutions to the various problems involved are beyond the scope of this book, many methods to solve these biological problems use ideas from several of the chapters in this book, thereby enabling scientists to accomplish tasks while using resources efficiently. The savings are in time, both human and machine, and in money, as more information can be extracted from laboratory techniques. 
  • The Internet enables people all around the world to quickly access and retrieve large amounts of information. With the aid of clever algorithms, sites on the Internet are able to manage and manipulate this large volume of data. Examples of problems that make essential use of algorithms include finding good routes on which the data will travel (techniques for solving such problems appear in,and using a search engine to quickly find pages on which particular information resides .  
  • Electronic commerce enables goods and services to be negotiated and ex- changed electronically, and it depends on the privacy of personal information such as credit card numbers, passwords, and bank statements. The core technologies used in electronic commerce include public-key cryptography and digital signatures (covered in Chapter 31), which are based on numerical algorithms and number theory.
  •  Manufacturing and other commercial enterprises often need to allocate scarce resources in the most beneficial way. An oil company may wish to know where to place its wells in order to maximize its expected profit. A political candidate may want to determine where to spend money buying campaign advertising in order to maximize the chances of winning an election. An airline may wish to assign crews to flights in the least expensive way possible, making sure that each flight is covered and that government regulations regarding crew scheduling are met. An Internet service provider may wish to determine where to place additional resources in order to serve its customers more effectively. All of these are examples of problems that can be solved using linear programming, which we shall study in Chapter 29. 
                                       Although some of the details of these examples are beyond the scope of this book, we do give underlying techniques that apply to these problems and problem areas. We also show how to solve many specific problems, including the following:
  • We are given a road map on which the distance between each pair of adjacent intersections is marked, and we wish to determine the shortest route from one intersection to another. The number of possible routes can be huge, even if we disallow routes that cross over themselves. How do we choose which of all possible routes is the shortest? Here, we model the road map (which is itself a model of the actual roads) as a graph (which we will meet in Part VI and Appendix B), and we wish to find the shortest path from one vertex to another in the graph. We shall see how to solve this problem efficiently in Chapter 24.
  •  We are given two ordered sequences of symbols, X =( x1,x 2,.....,xi) and Y=(  y1,y 2,.....,yi), and we wish to find a longest common sub sequence of X and Y. A sub sequence of X is just X with some (or possibly all or none) of its elements removed. For example, one sub sequence of  (A;B;C;D;E;F;G) would be B; C; E; G. The length of a longest common sub sequence of X and Y gives one measure of how similar these two sequences are. For example, if the two sequences are base pairs in DNA strands, then we might consider them similar if they have a long common sub sequence. If X has m symbols and Y has n symbols, then X and Y have 2 m and 2 n possible sub sequences,

What is an algorithm?

                An algorithm is a procedure followed to accomplish a specific task. An algorithm is the idea behind any reasonable computer program. To be interesting, an algorithm must solve a general, well-specified problem. An algorithmic problem is specified by describing the complete set of instances it must work on and of its output after running on one of these instances. This distinction, between a problem and an instance of a problem, is fundamental. For example, the algorithmic problem known as sorting is defined as follows:
Problem: Sorting
Input: A sequence of n keys a1,...,an.
Output: The permutation (reordering) of the input sequence such that a 1 ≤ a 2 ≤ ···≤a n−1 ≤ a n.
                 An instance of sorting might be an array of names, like {Mike, Bob, Sally, Jill,Jan }, or a list of numbers like {154, 245, 568, 324, 654, 324}. Determining that you are dealing with a general problem is your first step towards solving it. An algorithm is a procedure that takes any of the possible input instances and transforms it to the desired output. There are many different algorithms for solving the problem of sorting. For example, insertion sort is a method for sorting that starts with a single element (thus forming a trivially sorted list) and then incrementally inserts the remaining elements so that the list stays sorted.

source:algorithm design manual

Programming Puzzle Problem

Triangular Vertices

Consider the points on an infinite grid of equilateral triangles as shown 
below:
               x
              x x
             x x x
            x x x x
           x x x x x
               .
               .


Note that if we number the points from left to right and top to bottom, 
then groups of these points form the vertices of certain geometric shapes. For 
example, the sets of points {1,2,3} and {7,9,18} are the vertices of 
triangles, the sets {11,13,26,24} and {2,7,9,18} are the vertices of 
parallelograms, and the sets {4,5,9,13,12,7} and {8,10,17,21,32,34} are the 
vertices of hexagons.

Write a program which will repeatedly accept a set of points on this 
triangular grid, analyze it, and determine whether the points are the vertices 
of one of the following acceptable figures: triangle, parallelogram, or 
hexagon. In order for a figure to be acceptable, it must meet the following 
two conditions:
      1) Each side of the figure must coincide with an edge in the grid.
and   2) All sides of the figure must be of the same length.

Tuesday, September 2, 2014

Puzzle :5 men, a monkey and some coconuts

Five men crash-land their airplane on a deserted island in the South Pacific.  On their first day they gather as many coconuts as they can find into one big pile.  They decide that, since it is getting dark, they will wait until the next day to divide the coconuts.
That night each man took a turn watching for rescue searchers while the others slept.  The first watcher got bored so he decided to divide the coconuts into five equal piles.  When he did this, he found he had one remaining coconut.  He gave this coconut to a monkey, took one of the piles, and hid it for himself.  Then he jumbled up the four other piles into one big pile again.
To cut a long story short, each of the five men ended up doing exactly the same thing.  They each divided the coconuts into five equal piles and had one extra coconut left over, which they gave to the monkey.  They each took one of the five piles and hid those coconuts.  They each came back and jumbled up the remaining four piles into one big pile.
What is the smallest number of coconuts there could have been in the original pile?


Hint to puzzle : Five men, a monkey, and some coconuts

Let the original pile have n coconuts.  Let a be the number of coconuts in each of the five piles made by the first man, b the number of coconuts in each of the five piles made by the second man, and so on.
Write a Diophantine equation to represent the actions of each man.  Express n + 4 in terms of e + 1, and hence deduce the smallest possible value of n + 4.

Some Interesting Mathematical Puzzles.........


A rectangular sheet of paper is folded so that two diagonally opposite corners come together.  If the crease formed is the same length as the longer side of the sheet, what is the ratio of the longer side of the sheet to the shorter side?

Hint to puzzle : Folded sheet of paper

Draw a straight line between the two corners used to make the fold, and consider similar triangles.

------------------------------------------------------------------------------------------------------------
 Two logicians 
Two perfect logicians, S and P, are told that integers x and y have been chosen such that 1 < x < y and x +y < 100.  S is given the value x+y and P is given the value xy.  They then have the following conversation.
P:  I cannot determine the two numbers. S:  I knew that. P:  Now I can determine them. S:  So can I.
Given that the above statements are true, what are the two numbers?  (Computer assistance allowed.)
------------------------------------------------------------------------------------------------------------
 Confused bank teller 

A confused bank teller transposed the dollars and cents when he cashed a check for Ms Smith, giving her dollars instead of cents and cents instead of dollars.  After buying a newspaper for 50 cents, Ms Smith noticed that she had left exactly three times as much as the original check.  What was the amount of the check?  (Note: 1 dollar = 100 cents.)

Hint to puzzle 5: Confused bank teller

Let x be the number of dollars in the check, and y be the number of cents.  Using the fact that one dollar is equal to 100 cents, write a Diophantine equation connecting x and y.

-----------------------------------------------------------------------------------------------------------
Ant on a box 
A 12 by 25 by 36 cm cereal box is lying on the floor on one of its 25 by 36 cm faces.  An ant, located at one of the bottom corners of the box, must crawl along the outside of the box to reach the opposite bottom corner.  What is the length of the shortest such path?

Note: The ant can walk on any of the five faces of the box, except for the bottom face, which is flush in contact with the floor.  It can crawl along any of the edges.  It cannot crawl under the box.

Hint to puzzle 6: Ant on a box

The shortest path is a straight line over the top of the box.


Monday, September 1, 2014

Demise of an Idea and birth of another so called Java.

 Extract From the demise of an idea and birth of another so called java (sun microsystem). By now, the work on Oak had been significant but come the year 1993,people saw the demise of set-top boxes, interactive TV and the PDAs. A failure that completely ushered the inventors’ thoughts to be reinvented. Only a miracle could make the project a success now. And such a miracle awaited anticipation. NATIONAL CENTER FOR SUPERCOMPUTING APPLICATIONS (NCSA) had just unveiled its new commercial webbrowser for the internet the previous year. The focus of the team,now diverted towards where they thought the "next-wave" of computing would be−the internet. The team then divulged into the realms of creating the same embeddable technology to be used in the web browser space calling it AN APPLET −a small application. The teamnow neededa proper identity and they decided on naming the new technology they created Java ushering a new gen- eration of products for the internet boom. A by-product of the project was a cartoon named "DUKE"created by Joe Parlang which became its identity then.