Posts

Time Complexity of Sortings

  Time Complexity of  Sorting Algorithm....     Bubble Sort  Selection Sort  Insertion Sort  these above have time complexity of order  = O(n*n) .

Calculator by java programming language

 import java.util.Scanner; public class Calculator{     public static void main(String args[]){         Scanner input = new Scanner(System.in);         char opr;         float a,b;         System.out.println("input the value\t");         a = input.nextFloat();         opr = input.next().charAt(0);         b = input.nextFloat();         if(opr=='+')         {             System.out.print(a+b);         }         else if(opr=='-')         {           ...

C program to find Factorial of any number

#include<stdio.h> int main() { int num, fact=1, i=1; printf("enter any number to find factorial \t"); scanf("%d",&num); while(i<=num) { fact=fact*i; i++; } printf("factorial = %d",fact); return 0; }

Psuedo math trick......

Do you know the value of  - 1-2+3-4+5-6+.........=1/4 Let  S=1-2+3-4+.......           _(1) Now adding s in equation (1) like binomial S=1-2+3-4+....... S=   1-2+3-4+....... 2S=-1+1-1+1-....... Now multiply by minus sign -2S=1-1+1-1+1-.......... We know that  1-1+1-1+1-........=1/2 //See my previous blog. Now -2S=1/2 S = -1/4

DO YOU KNOW SUM OF 1-1+1-1+1-...........=1/2

psuedo math..... DO YOU KNOW SUM OF 1-1+1-1+1-...........=1/2 》  s=1-1+1-1+1-........ now multiply by minus sign -s=-1+1-1+1-1+........ now add 1on both side 1-s=1-1+1-1+1-....... rhs value is equal to s then 1-s=s 2s=1 s=1/2