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

DATA STRUCTURE SYLLABUS

Data Structures  
SECTION-A 
1. Basic Concepts and Notations, Introduction to Complexity, Data Structure and Data Structure operations. Applications of Data Structure. Basic data Structures: Arrays: Introduction, Types of Array, Memory representation, Applications and operations. Stacks and queue: Introduction, memory representation, Applications and operations 
(No. of Periods : 15) 
SECTION-B 
 2. Linked List: Operations:-traversing, searching, inserting, deleting, operations on header linked list, circular linked list, doubly linked list, memory representation, Applications, polynomial manipulation. 
( No. of Periods : 15) 
SECTION-C 

3. Trees – Definition and Basic concepts, Representation in Contiguous Storage, Binary Tree, Binary Tree Traversal, Searching, Insertion and deletion in Binary trees, Binary Search tree, AVL trees.
 (No. of Periods : 15)
 SECTION-D
4. Searching: Binary and Linear Search. Sorting: Bubble sort, Insertion sort, Selection sort, Merge Sort, Radix sort, Quick sort, S…

COMPUTER BASED NUMERICAL & METHOD(CONM) Syllabus

SyllabusBCA-2nd Year: SECTION-A 
 1. Computer Arithmetic :Floating Point Numbers, operations, normalizations and    their consequences, Errors and its types. 
 2. Iterative Methods :Bisection, False-Position, Newton - Raphson Methods,  Zeros of a polynomial using Birge – Vieta Method. 

(No. of Periods : 15)
SECTION B
3.Simultaneous Linear Equations : Solution of Simultaneous Linear Equations Using Gauss - Elimination, Gauss-Jordan and Gauss-Seidal Methods, Concept of Pivoting.  
4.Interpolation:  Lagrange,  Newton  forward,  Newton  Backward,  Divided  Difference, Newton forward difference, Newton Backward difference, Numerical  Integration: Trapezoidal, Simpson’s 1/3, Simpson’s 3/8, Weddle and Runga–    Kutta Methods: 2nd order & 4th order.

      (No. of Periods : 15) 

SECTION-C
5. Measures of Central Tendency:Peparing Frequency distribution table, Arithmetic mean, Geometric mean, Harmonic mean, Median and Mode.        6. Measures  of  Dispersion,  Skewness and Kurtosis,  Range :Mean   d…

ENVIRONMENT AND ROAD SAFETY EDUCATION

SEMESTER – IINote: 

The syllabus has 15 topics to be covered in 25-hour lectures in total, with 2 lectures in each topic from 2 to 11 and one each for the topics 1 and 12 to 15.

1. Environment Concept: Introduction, the concept of biosphere – lithosphere, hydrosphere, atmosphere; Natural resources – their need and types; Principles and scope of Ecology; concepts of the ecosystem, population, community, biotic interactions, biomes, ecological succession.

2. Atmosphere: Parts of atmosphere, components of air; pollution, pollutants, their sources, permissible limits, risks and possible control measures.

3. Hydrosphere: Types of aquatic systems; Major sources (including ground water) and uses of water, problems of the hydrosphere, fresh water shortage; pollution and pollutants of water, permissible limits, risks and possible control measures.

4. Lithosphere: Earth crust, soil – a life support system, its texture, types, components, pollution and pollutants, reasons of soil erosion and poss…