Posts

Showing posts with the label Computer Science

Recursion

Image
recursion rɪˈkəːʃ(ə)n/ noun MATHEMATICS LINGUISTICS noun:  recursion the repeated application of a recursive procedure or definition. a recursive definition. plural noun:  recursions Basically recursion is doing something repeatedly. In programming recursion is an act of calling itself in the function/ method scope. Think of a program where you want to count down from any given number. As an example if we input 10 then it should count from 3 to 0. We can do this using a recursive function. class Recursion{     public static void main(String args[]){   count(3); } public static void count(int n){ System.out.println(n); count(n-1);   } } The function/method count, prints n taken as its parameter and call the count method again. The output will be: 3 2 1 0 -1 -2 -3 -4 -5 ... ..- ... The method call itself recursively, so that there will be no end. It c...

Number Systems

We use numbers not only to show values but also for calculating purposes. So a number system which is easy to manipulate was needed when more complex calculations come across with the evolution of man kind. Different number systems were used in the past with different notations. At the early stages they have used one character such as '1' to represent one unit. this is called as Unary numeral system . As example One 1 Two 11 Three 111 Four 1111 Five 11111 Six 111111 Seven 1111111 Eight 11111111 Nine 111111111 Ten 1111111111 Eleven 11111111111 And when they started counting more lager numbers, using the above number system was impossible so they started using a pattern to count. One 1 Two 11 Three 111 Four 1111 Five 1111 Six 1111 1 Seven 1111 11 Eight 1111 111 Nine 1111 1111 Ten 1111 1111 Eleven 1111 1111 1 In the above number system they have count things by grouping them into five.'  1111  ' symbol is used to represent a gro...

Flow Charts

Image
What is a problem? Problem solving techniques Algorithm Flowcharts Flow chart symbols/notations Basic symbols Line symbols Special symbols Data symbols Process symbols Flow control structures Sequences Selections If If/else Switch/ case Iteration While loop Do while loop Repeat Until For next loop Questions and Answers References What is a problem?                   A problem is an obstacle, impediment, difficulty or challenge, or any situation that invites resolution; the resolution of which is recognized as a solution or contribution toward a known purpose or goal. Problem Solving Techniques There are many problem solving techniques we can use to solve problems. Some are shown below... Structured approach Top down approach Brute force approach Divide and conquer approach Algorithm is an example for the structured approach   problem solving method….   What is Algorithm?...