Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Bubble Sort and Linear Search, Cheat Sheet of Data Structures and Algorithms

The document consists of pseudocode for Bubble Sort and Linear Search in C language.

Typology: Cheat Sheet

2021/2022

Uploaded on 11/27/2023

ashmita-sharma
ashmita-sharma 🇮🇳

1 document

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Bubble Sort and Linear Search and more Cheat Sheet Data Structures and Algorithms in PDF only on Docsity! BUBBLE SORT Source Code(c): #include <stdio.h> void main() { int n , i,arr[50],j,temp; printf("Enter the no of the elements:"); scanf("%d",&n); printf("Enter %d elements of array\n",n); for ( i = 0; i < n; i++){ scanf("%d",&arr[i]); } for ( i = 0;i < n; i++){ for ( j = 0; j < n-i-1;j++){ if(arr[j]>arr[j+1]){ temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } for ( i = 0;i < n;i++){ printf("%d ",arr[i]); } }
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved