Skip to main content

Posts

Featured Post

Sets , Cardinality and Power Set in Set Theory

Set - Set is an ordered collection of distinct elements . Set is the part of basically Discrete Mathematics but widely used in most of the fields as Set Thory , Permutations and Combinations , Artificial Intelligence , Machine language etc in the form of Sets .

example -
A = { 1 , 2 , 3 , 4 , 5}
B = { 1 , 2 , 2 ,3 ,4}
a = { 1 , 2 , 3 , 4 , 5}
C = { 1 , 2 , A , B , क , ख  , ग }

Note -

Here A is a Set because it contains all the distinct elements .Here B is not a Set because it contains duplicate element 2 .a is not a Set because it must be represented by capital letter as A .C is a Set if all the letters of Hindi , english , symbols , Integers are allowed Otherwise not a Set .  Cardinality of Set - It shows the number of elements available in that Set .
example -  A = { 1,2,3,4,5} Cardinality of A = | A | = 5 
Representation of Sets - There are several methods to represent a set like - 
1. Tabular / Roaster Method - This method basically applies on the sets of small number of elements tha…
Recent posts

Pipelining in Computer Architecture

Pipelining is a technique to process the data in parallel way . In this technique multiple instructions are overlapped during execution. Pipeline is divided into stages and Each stage completes a part of an instruction in parallel.

Pipelining increases the overall Throughput of executing instructions . Throughput of

Types of Pipelines -

Arithmatic Pipeline -The arithmetic pipeline represents the parts of an arithmetic operation that can be broken down and overlapped as they are performed .Instruction Pipeline - The instruction pipeline represents the stages in which an instruction is moved through the processor, including its being fetched, perhaps buffered , decoding , and then executed. Instruction pipelining is a technique used in the design of modern microprocessors, microcontrollers and CPUs to increase their instruction throughput . Instruction Throughput = The number of instructions that can be executed in a unit of time . Basically CPUs are driven by a clock. The CPU consists …

CPU Scheduling in Operating System

What is CPU or Process Scheduling -
Let say , there are 5 different applications in our  computer system Hard Drive A , B ,C , D , E . When we execute these apps , we say them processes . Some of these processes load into main memory at the booting time and some of execute when we require to execute But the procedure of loading those processes from hard disk to main memory and then execute , may wait also for some time , and to execute all processes in a proper scheduled way to improve overall throughput and efficiency of system is to be said , Process or Cpu scheduling .

What are the different states in which processes reside - 



The execution or life of a process from its origin to end , can be categorized into some different stages , from where that process passes during entite life cycle . We say process states to these stages and the different states are -  Ready StateRunning Queue Wait Queue Running QueueTermination
What is Dispatcher -  Dispatcher is a function in operating systems…

Kernaugh Map solving to reduce the electronic circuits size

Kernaugh map is the technique to reduce the design of an electronic circuit . Any electronic circuit is made of different different small circuits like Multiplexers . Multiplexers uses binary values as inputs and produce the output in the binary format also and then converts these digital values into analog signal to perform the desired output .
Let , we take a Truth table of a 2-input Multiplexer as below with A,B , S as Inputs and Y as output  -

SABY00000010010101111000101111001111 To design the reduced circuit from the truth table of this circuit , we need only the the output as 1 ( We say the outputs  1 are Minterms of standered sum of products .) .

So the output function in the terms of minterms as -
Y = Σ(2, 3, 5, 7)

Here we can reduce electronic circuit , using the boolean algebra rules but it becomes very hard to reduce the size of circuit , when circuit is too big and have Large number of inputs and then the Technique of Kernaugh Map comes into the picture to solve the circui…

Time Complexity for Searching and Sorting Algorithms

Every algorithm works with its own complexity level and Time complexity of an algorithm tells us the time consumed to execute n number of inputs on a system . Many of the algorithms work better with small number of inputs but can not perform better with large number of inputs .

There are 3 different cases for complexity as below -

1. Best Case Time Complexity -

The best time in which we can obtain desired output from an algorithm shows best case for that algorithm and shown by Omega ( Ω ) Notation . We also say this  Lower Bound because it is the minimum possible time to get desired outpit with that algorithm .

2. Worst Case Time Complexity -

The Worst time in which we obtain desired output from an algorithm shows Worst case for that algorithm and shown by Big Oh( O ) Notation .  We also say this  Upper Bound because it is the maximum possible time to get desired outpit with that algorithm .

3. Average Case Time Complexity -

The Average time in which we obtain desired output from an al…

Why Merge Sort is better than Insertion Sort

Insertion sort is better for small number of inputs ony but while incrementing the number of inputs to 1000 or millions or billions , Merge sort performs better than Insertion Sort .

To decide the better algorithm , we need to look at the time complexities of both sorting algorthms before . While executing an algorithm if it uses n inputs then the time complexity for Insertion sort is pn*n and for Merge Sort is q*n*ln n . Here p and q are constants and generally p < q .

Time complexity does not depend on the constants like p and q .

To understand it deeply , We take two computers A and B with the following features -

A is with good Architecture and  much faster than computer B .B is with poor achitecture and slower than computer A .We are executing Insertion Sort on the computer A and Merge sort on Computer B .Both of these algo differs with respect to n and ln n terms in the complexities . If we test both of them for n = 100 inputs then the Insertion sort takes n=100 but Merge sor…

C Program to print Pascal's Triangle

// C Program to print n Lines of Pascal's Triangle

#include <stdio.h>

int main()

{

    int rows, coeficient = 1, space, i, j;



    printf("Enter number of rows: ");

    scanf("%d",&rows);



    for(i=0; i<rows; i++)

    {

        for(space=1; space <= rows-i; space++)

            printf("  ");



        for(j=0; j <= i; j++)

        {

            if (j==0 || i==0)

                coeficient = 1;

            else

                coeficient = coeficient*(i-j+1)/j;



            printf("%4d", coeficient);

        }

        printf("\n");

    }



    return 0;

}
Output :
Enter number of rows: 
If User Inputs 6 Then outout Is -
1
11
121
1331
14641
1 5 10 10 5 1