Posts

C Program For Merge Sort | C Programming

C Program For Merge Sort by Generating Random Numbers and Using time.h Function #include <stdio.h> #include <stdlib.h> #include <time.h> void mergesort ( int a [], int i , int j ); void merge ( int a [], int i1 , int j1 , int i2 , int j2 ); int main () {     int a [ 30 ], n , i ;     time_t t ;     printf ( "Enter the max number \n " );     scanf ( " %d " , & n );     srand (( unsigned ) time (& t ));     for ( i = 0 ; i < n ; i ++)     {         a [ i ] = rand () % 100 ;     }     for ( i = 0 ; i < n ; i ++)     {         printf ( " %d \t " , a [ i ]);     }     mergesort ( a , 0 , n - 1 );     printf ( " \n\n Time taken to complete the mergesort %u \n " , clock () / CLOCKS_PER_SEC);     printf ( " \n Sorted array is : \n " );     for ( i = 0 ; i < n ; i ++)         printf ( " %d \t " , a [ i ]);     return 0 ; } void mergesort ( int a [], int i , int j ) {

C Program For Quick Sort | C Programming

C Program For Quick Sort To Generate Random Number and Sort it #include <stdio.h> #include <stdlib.h> void quicksort ( int number [ 25 ], int first , int last ) {     int i , j , pivot , temp ;     if ( first < last )     {         pivot = first ;         i = first ;         j = last ;         while ( i < j )         {             while ( number [ i ] <= number [ pivot ] && i < last )                 i ++;             while ( number [ j ] > number [ pivot ])                 j --;             if ( i < j )             {                 temp = number [ i ];                 number [ i ] = number [ j ];                 number [ j ] = temp ;             }         }         temp = number [ pivot ];         number [ pivot ] = number [ j ];         number [ j ] = temp ;         quicksort ( number , first , j - 1 );         quicksort ( number , j + 1 , last );     } } int main () {     int i , count , number [ 1000 ];     printf (

View of Data | Data Abstraction | Instances and Schema in DBMS

Image
View of Data The system hides certain details of how the data are stored and maintained and such view is an abstract view. The Database System provides users with an abstract view of the data.

Computer Network Topology and its Types | Computer Network

Image
Topology means the physical design of a network including the devices, location and cable installation. Logical Topology refers to the fact that how data actually transfers in a network as opposed to its design.

Ethernet (802.3), CSMA/CD (Carrier Sense Multiple Access / Collision Detection) | Computer Network

Image
Computer Network | Ethernet (802.3) Ethernet is the most widely-installed local area network (LAN) technology. Ethernet was originally developed by Xerox from an earlier specification called Aloha net and then developed further by Xerox, DEC, and Intel. An Ethernet LAN typically uses coaxial cable or special grades of twisted pair wires. Ethernet is also used in wireless. Ethernet is standardized as IEEE 802.3 that specifies a CSMA/CD bus network. CSMA/CD (Carrier Sense Multiple Access / Collision Detect) is used to detect the collision in the network. An Ethernet CSMA/CD can be implemented using a Bus or even a Star topology.

CISC and RISC Computers

Image
Why CISC? •            Compiler simplification? –           Disputed… –           Complex machine instructions harder to exploit –           Optimization more difficult •            Smaller programs? –           Program takes up less memory but… –           Memory is now cheap –           May not occupy less bits, just look shorter in symbolic form •            More instructions require longer op-codes •            Register references require fewer bits •            Faster programs? –           Bias towards use of simpler instructions –           More complex control unit –           Microprogram control store larger –           thus simple instructions take longer to execute –           It is far from clear that CISC is the appropriate solution

Moore and Mealy Machine | Theory Of Computation (TOC)

Image
Theory Of Computation | (TOC)Moore Machine Moore machine is an FSM whose outputs depend on only the present state. A Moore machine can be described by a 6 tuples M = ( Q, Σ, Δ, 𝛿, λ, q 0 ) Where, Q = finite set of states. Σ = finite set of symbols called the input alphabet. Δ = finite set of symbols called the output alphabet. 𝛿 = input transition function where  𝛿 : Q✕ Σ →Q   λ = output transition function where   λ :  Q → Δ q 0 = initial state from Where any input is processed ( q 0 ∈Q).