Skip to main content

BUBBLESORT

Q1Write a C program for BubbleSort ?


#include<conio.h>                                        
#include<stdio.h>                                         
void main()                                                    
{                                                                     
int i,j,n,tmp,a[20];                                           
clrscr();                                                          
//Intialising Array 
printf("\nEnter the number of elements--\t");  
scanf("%d",&n);                                              
printf("\nThe Elements are----\n");                  
for(i=0;i<n;i++){                                               
scanf("%d",&a[i]);}                                          
//Bubble Sort Algorithm  
                               
for(i=1;i<n;i++)                                                
{                                                                      
for(j=0;j<n-i;j++)                                              
{                                                                     
//Ascending Order
if(a[j]>a[j+1]){                                                 
tmp=a[j];                                                        
a[j]=a[j+1];                                                      
a[j+1]=tmp;                                                    
}                                                                     
}                                                                    
}                                                                     
//Output 
printf("After BubbleSort\n");                            
for(j=0;j<n;j++)                                               
{                                                                     
printf("%d\t",a[j]);                                           
}                                                                     
getch();                                                          
}                                                                      


***********************************************************************************

Sample Output:





Comments

Popular posts from this blog

COMPUTER ORGANISATION

6TH SEMESTER: SECTION-A 
1. Computer Organisation : Evolution of Computers, Stored program concept and Von Neumann Architecture, Information representation and codes, Combinatorial Blocks : Gates, Multiplexers, Decoders, Encoders, Sequential Building blocks : Flip-Flops, Registers, Counters, Arithmetic algorithms : Addition and subtraction for signed magnitude and 2's complement numbers, integer multiplication using shift and add, Booth's algorithms, Integer and floating point representation.

SECTION-B
 2. Architecture of a Simple Processor : An instruction set, Addressing Modes, Instruction formats, Instruction execution in terms of Microinstructions, Concept of interrupt and simple I/O organisation, I/O organization : Strobe-based and Handshake based communication, Vector and priority interrupts, DMA-based data transfer; CPU organisation with large registers, Stacks and handling of interrupts and subroutines. Concept of Bus, data movement among registers, data movement from/to…

ENTREPRENEURSHIP DEVELOPMENT PROGRAMME SYLLABUS

ENTREPRENEURSHIP DEVELOPMENT PROGRAMME
SECTION-A 
1.Project Formulation :

Need, Scope and approaches for project formulation; the structure of project report; study and analysis of sample project report; preparation of a project report; Techno- economic feasibility of the project. (No. of Periods : 25)

SECTION-B
2. Finance & Accounting :

Working capital assessment, its management & exercise thereon; Assessment of fixed capital and exercise thereon; Capital budgeting; Product costing and cost consciousness. Financial ratios and their significance; Break-even analysis; Credit institutions and financing procedures; Books of accounts, financial statements & fund flow analysis.

SECTION-C
3. Managing the Enterprise:

Resource management – men, material, money, and machines; Personnel management, Office management. E-Commerce: Introduction to E-Commerce, Benefits, Impact of E-Commerce, Classification of E-Commerce, Application of E-Commerce.

SECTION - D
4. Rules & Regulations:

Lic…

COMPUTER NETWORKS

6TH SEMESTER - SECTION-A
1. Introduction to Data Communication: Data Communication fundamentals, Simplex, Half-Duplex, Full-Duplex Network definition, Network Hardware and Software, Network Topologies, Uses of Computer Networks, OSI reference model, TCP/IP Reference Model. Comparison of OSI & TCP/IP reference model. 2. Physical Layer: Transmission Media, Switching, ISDN & its services, Multiplexing, Modems.

SECTION-B
3. Data Link Layer: Design Issue, Error Detection & Correction Codes, Elementary Data Link Protocols, Static & Dynamic Channel Allocation, Introduction to IEEE standards, Sliding Window Protocols: One-bit Sliding Window Protocol, Go Back n, Selective Repeat.