SlideShare a Scribd company logo
C  programming array & shorting
NOTES
NOTES
NOTES
NOTES
#include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int arr[10], i; 
clrscr(); 
printf(“Enter Array Elementn”); 
for(i=0;i<10;i++) 
{ 
scanf(“%d”, &arr[i]); 
} 
printf(“Array Elementn”); 
for(i=0;i<10;i++) 
{ 
printf(“%dn”,arr[i]); 
} 
getch(); 
} 
EXTRA
EXTRA
EXTRA
NOTES
EXTRA
EXTRA
#include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int arr[100], s, i , j, temp; 
clrscr(); 
printf(“Enter Array Sizen”); 
scanf(“%d”,&s); 
printf(“Enter Array Elementn”); 
for(i=0;i<s;i++) 
{ 
scanf(“%d”, &arr[i]); 
} 
printf(“Array Element befor sortingn”); 
for(i=0;i<s;i++) 
{ 
printf(“%dn”, arr[i]); 
} 
EXTRA
for(i=0;i<s-1;i++) 
{ 
for(j=0;j<s-1-i;j++) 
{ 
if(arr[j]>arr[j+1]) 
{ 
temp=arr[j]; 
arr[j]=arr[j+1]; 
arr[j+1]=temp; 
} 
} 
} 
printf(“Data after sorting n”); 
for(i=0;i<s;i++) 
{ 
printf(“%dn”, arr[i]); 
} 
getch(); 
} 
EXTRA
EXTRA
#include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int arr[100], s, i , j, temp; 
clrscr(); 
printf(“Enter Array Sizen”); 
sxcanf(“%d”,&s); 
printf(“Enter Array Elementn”); 
for(i=0;i<s;i++) 
{ 
scanf(“%d”, &arr[i]); 
} 
printf(“Array Element befor sortingn”); 
for(i=0;i<s;i++) 
{ 
printf(“%dn”, arr[i]); 
} 
EXTRA
for(i=0;i<s-1;i++) 
{ 
for(j=i+1;j<s;j++) 
{ 
if(arr[i]>arr[j]) 
{ 
temp=arr[i]; 
arr[i]=arr[j]; 
arr[j]=temp; 
} 
} 
} 
printf(“Data after sortingn”); 
for(i=0;i<s;i++) 
{ 
printf(“%dn”,arr[i]); 
} 
getch(); 
} 
EXTRA
EXTRA
EXTRA
#include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int arr[10],s, p, temp,i,k; 
clrscr(); 
printf("enter Array Sizen"); 
scanf("%d",&s); 
printf("Enter Array Elementn"); 
for(i=0;i<s;i++) 
{ 
scanf("%d",&arr[i]); 
} 
printf("Array Elementn"); 
for(i=0;i<s;i++) 
{ 
printf("%dn",arr[i]); 
} 
EXTRA
for(i=1;i<s;i++) 
{ 
p=i-1; 
temp=arr[i]; 
while(temp<arr[p]&&p>=0) 
{ 
arr[p+1]=arr[p]; 
p--; 
} 
arr[p+1]=temp; 
} 
printf("Data after sortingn"); 
for(i=0;i<s;i++) 
{ 
printf("%dn",arr[i]); 
} 
getch(); 
} 
EXTRA
Searching 
Linear Search Binary Search 
EXTRA 
Linear Search- This is the simplest technique to find 
out an element in an unsorted list. 
In this technique the value of the key is compared with the 
first element of the list, if match is found then the search is 
terminated. Otherwise next element from the list is fetched 
and compared with the key and this process is continued till 
the key is found or list is completely.
EXTRA 
Binary Search- Binary search works for sorted lists and is a 
very efficient searching technique. It is used to find the 
location of a given element or record in a list. Other 
information associated with the element can also be 
fetched if required. To find the location of a file in the 
computer directory one can use this searching technique. 
Let low represents lower limit of the list l, high upper and 
mid is average of low and high that is middle of the lower 
and upper limits. 
Mid = (low+high)/2; 
we compare the middle element with key to be searched. If 
the value of middle element is greater than key ,then key 
will exit in lower half of the list, take high = mid-1 and find 
new value of mid.
#include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int arr[100],s, i, first=0, mid=0, last =0, count =0, num; 
clrscr(); 
printf(“Enter Array Sizen”); 
scanf(“%d”,&s); 
printf(“Enter Array Elementn”); 
for(i=0;i<s;i++) 
{ 
scanf(“%d”,&arr[i]); 
} 
printf(“Array Elementn”); 
for(i=0;i<s;i++) 
{ 
printf(“%dn”,arr[i]); 
} 
EXTRA
printf(“Enter the no want to search n”); 
scanf(“%d”,&num); 
last = s-1; 
while((first<=last)&&(count==0)) 
{ 
mid=(first+last)/2; 
if(arr[i]==num) 
{ 
count=mid; 
} 
else if(arr[i]<num) 
{ 
first=mid+1; 
} 
else 
{ 
last=mid-1; 
} 
} 
EXTRA
if(count>0) 
{ 
printf(“No 
found”); 
} 
else 
{ 
printf(“No not found”); 
} 
getch(); 
} 
EXTRA
Double Dimension Array #include<stdio.h> 
#include<conio.h> 
void main() 
{ 
int arr[3][3], i, j; 
clrscr(); 
printf(“Enter Array Elementn”); 
for(i=0;i<3;i++) 
{ 
for(j=0;j<3;j++) 
{ 
scanf(“%d”,&arr[i][j]); 
} 
} 
printf(“Matrix nn”); 
for(i=0;i<3;i++) 
{ 
for(j=0;j<3;j++) 
{ 
printf(“%d ”,arr[i][j]); 
} 
printf(“n”); 
} 
getch(); 
} 
EXTRA

More Related Content

What's hot (20)

1D Array
1D Array1D Array
1D Array
A. S. M. Shafi
 
ADA FILE
ADA FILEADA FILE
ADA FILE
Gaurav Singh
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
vrgokila
 
SaraPIC
SaraPICSaraPIC
SaraPIC
Sara Sahu
 
c-programming-using-pointers
c-programming-using-pointersc-programming-using-pointers
c-programming-using-pointers
Sushil Mishra
 
C program
C programC program
C program
Komal Singh
 
Cpds lab
Cpds labCpds lab
Cpds lab
praveennallavelly08
 
Session06 functions
Session06 functionsSession06 functions
Session06 functions
HarithaRanasinghe
 
Examples sandhiya class'
Examples sandhiya class'Examples sandhiya class'
Examples sandhiya class'
Dr.Sandhiya Ravi
 
4. chapter iii
4. chapter iii4. chapter iii
4. chapter iii
Chhom Karath
 
Practical File of C Language
Practical File of C LanguagePractical File of C Language
Practical File of C Language
RAJWANT KAUR
 
design and analysis of algorithm Lab files
design and analysis of algorithm Lab filesdesign and analysis of algorithm Lab files
design and analysis of algorithm Lab files
Nitesh Dubey
 
C Prog. - Structures
C Prog. - StructuresC Prog. - Structures
C Prog. - Structures
vinay arora
 
Understanding storage class using nm
Understanding storage class using nmUnderstanding storage class using nm
Understanding storage class using nm
mohamed sikander
 
DataStructures notes
DataStructures notesDataStructures notes
DataStructures notes
Lakshmi Sarvani Videla
 
Ada file
Ada fileAda file
Ada file
Kumar Gaurav
 
DAA Lab File C Programs
DAA Lab File C ProgramsDAA Lab File C Programs
DAA Lab File C Programs
Kandarp Tiwari
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
PRATHAMESH DESHPANDE
 
C Prog - Strings
C Prog - StringsC Prog - Strings
C Prog - Strings
vinay arora
 
3. chapter ii
3. chapter ii3. chapter ii
3. chapter ii
Chhom Karath
 

Viewers also liked (20)

C programming function
C  programming functionC  programming function
C programming function
argusacademy
 
C programming string
C  programming stringC  programming string
C programming string
argusacademy
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
Gagan Deep
 
Arrays
ArraysArrays
Arrays
archikabhatia
 
Array in c language
Array in c languageArray in c language
Array in c language
home
 
Array in c
Array in cArray in c
Array in c
Ravi Gelani
 
C programming session 01
C programming session 01C programming session 01
C programming session 01
Dushmanta Nath
 
Array in c
Array in cArray in c
Array in c
AnIsh Kumar
 
Array in c
Array in cArray in c
Array in c
AnIsh Kumar
 
Excel vba macro programing
Excel vba macro programingExcel vba macro programing
Excel vba macro programing
University of Narotama
 
C string
C stringC string
C string
University of Potsdam
 
Strings in C
Strings in CStrings in C
Strings in C
Kamal Acharya
 
C programming - String
C programming - StringC programming - String
C programming - String
Achyut Devkota
 
Lab 5 array
Lab 5 arrayLab 5 array
Lab 5 array
mkazree
 
Application software
Application softwareApplication software
Application software
argusacademy
 
Php oops1
Php oops1Php oops1
Php oops1
argusacademy
 
Computer development
Computer developmentComputer development
Computer development
argusacademy
 
TALLY Payroll ENTRY
TALLY Payroll ENTRYTALLY Payroll ENTRY
TALLY Payroll ENTRY
argusacademy
 
Php basic
Php basicPhp basic
Php basic
argusacademy
 
VISUAL BASIC .net ii
VISUAL BASIC .net iiVISUAL BASIC .net ii
VISUAL BASIC .net ii
argusacademy
 
Ad

Similar to C programming array & shorting (20)

Ds
DsDs
Ds
kooldeep12345
 
Data structure output 1
Data structure output 1Data structure output 1
Data structure output 1
Balaji Thala
 
Programs
ProgramsPrograms
Programs
kulwinderbawa007
 
Sorting programs
Sorting programsSorting programs
Sorting programs
Varun Garg
 
COgdfgdffgdgfgdasdasdaffadadsdsd5ANS.pdf
COgdfgdffgdgfgdasdasdaffadadsdsd5ANS.pdfCOgdfgdffgdgfgdasdasdaffadadsdsd5ANS.pdf
COgdfgdffgdgfgdasdasdaffadadsdsd5ANS.pdf
mbpgbca
 
Array Programs.pdf
Array Programs.pdfArray Programs.pdf
Array Programs.pdf
RajKamal557276
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
Lakshmi Sarvani Videla
 
array.ppt
array.pptarray.ppt
array.ppt
DeveshDewangan5
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
sandeep kumbhkar
 
programs on arrays.pdf
programs on arrays.pdfprograms on arrays.pdf
programs on arrays.pdf
sowmya koneru
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
Er Ritu Aggarwal
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
Syed Tanveer
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
codes.txt.pdf code presentation engineering
codes.txt.pdf  code presentation engineeringcodes.txt.pdf  code presentation engineering
codes.txt.pdf code presentation engineering
ts5092207
 
C programs
C programsC programs
C programs
Koshy Geoji
 
C lab manaual
C lab manaualC lab manaual
C lab manaual
manoj11manu
 
Module 5 PPS.pptnwnekdnndkdkdnnsksosmsna
Module 5 PPS.pptnwnekdnndkdkdnnsksosmsnaModule 5 PPS.pptnwnekdnndkdkdnnsksosmsna
Module 5 PPS.pptnwnekdnndkdkdnnsksosmsna
mitivete
 
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docxMerge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
scroghamtressie
 
Write a program to check a given number is prime or not
Write a program to check a given number is prime or notWrite a program to check a given number is prime or not
Write a program to check a given number is prime or not
aluavi
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)
Ankit Gupta
 
Data structure output 1
Data structure output 1Data structure output 1
Data structure output 1
Balaji Thala
 
Sorting programs
Sorting programsSorting programs
Sorting programs
Varun Garg
 
COgdfgdffgdgfgdasdasdaffadadsdsd5ANS.pdf
COgdfgdffgdgfgdasdasdaffadadsdsd5ANS.pdfCOgdfgdffgdgfgdasdasdaffadadsdsd5ANS.pdf
COgdfgdffgdgfgdasdasdaffadadsdsd5ANS.pdf
mbpgbca
 
Solutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structuresSolutionsfor co2 C Programs for data structures
Solutionsfor co2 C Programs for data structures
Lakshmi Sarvani Videla
 
All important c programby makhan kumbhkar
All important c programby makhan kumbhkarAll important c programby makhan kumbhkar
All important c programby makhan kumbhkar
sandeep kumbhkar
 
programs on arrays.pdf
programs on arrays.pdfprograms on arrays.pdf
programs on arrays.pdf
sowmya koneru
 
Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02Daapracticals 111105084852-phpapp02
Daapracticals 111105084852-phpapp02
Er Ritu Aggarwal
 
Cpd lecture im 207
Cpd lecture im 207Cpd lecture im 207
Cpd lecture im 207
Syed Tanveer
 
Chapter 8 c solution
Chapter 8 c solutionChapter 8 c solution
Chapter 8 c solution
Azhar Javed
 
codes.txt.pdf code presentation engineering
codes.txt.pdf  code presentation engineeringcodes.txt.pdf  code presentation engineering
codes.txt.pdf code presentation engineering
ts5092207
 
Module 5 PPS.pptnwnekdnndkdkdnnsksosmsna
Module 5 PPS.pptnwnekdnndkdkdnnsksosmsnaModule 5 PPS.pptnwnekdnndkdkdnnsksosmsna
Module 5 PPS.pptnwnekdnndkdkdnnsksosmsna
mitivete
 
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docxMerge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
scroghamtressie
 
Write a program to check a given number is prime or not
Write a program to check a given number is prime or notWrite a program to check a given number is prime or not
Write a program to check a given number is prime or not
aluavi
 
program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)program on string in java Lab file 2 (3-year)
program on string in java Lab file 2 (3-year)
Ankit Gupta
 
Ad

More from argusacademy (20)

Css & dhtml
Css  & dhtmlCss  & dhtml
Css & dhtml
argusacademy
 
Html table
Html tableHtml table
Html table
argusacademy
 
Html ordered & unordered list
Html ordered & unordered listHtml ordered & unordered list
Html ordered & unordered list
argusacademy
 
Html level ii
Html level  iiHtml level  ii
Html level ii
argusacademy
 
Html frame
Html frameHtml frame
Html frame
argusacademy
 
Html forms
Html formsHtml forms
Html forms
argusacademy
 
Html creating page link or hyperlink
Html creating page link or hyperlinkHtml creating page link or hyperlink
Html creating page link or hyperlink
argusacademy
 
Html basic
Html basicHtml basic
Html basic
argusacademy
 
Java script
Java scriptJava script
Java script
argusacademy
 
Php string
Php stringPhp string
Php string
argusacademy
 
Php session
Php sessionPhp session
Php session
argusacademy
 
Php opps
Php oppsPhp opps
Php opps
argusacademy
 
Php if else
Php if elsePhp if else
Php if else
argusacademy
 
Php creating forms
Php creating formsPhp creating forms
Php creating forms
argusacademy
 
Php create and invoke function
Php create and invoke functionPhp create and invoke function
Php create and invoke function
argusacademy
 
Php array
Php arrayPhp array
Php array
argusacademy
 
Sql query
Sql querySql query
Sql query
argusacademy
 
Rdbms
RdbmsRdbms
Rdbms
argusacademy
 
Oracle
OracleOracle
Oracle
argusacademy
 
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
argusacademy
 

Recently uploaded (20)

How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptxAnalysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18
Celine George
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
BUSINESS QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 9 SEPTEMBER 2024
Quiz Club of PSG College of Arts & Science
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptxRai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Rai dyansty Chach or Brahamn dynasty, History of Dahir History of Sindh NEP.pptx
Dr. Ravi Shankar Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Pfeiffer "Secrets to Changing Behavior in Scholarly Communication: A 2025 NIS...
Pfeiffer "Secrets to Changing Behavior in Scholarly Communication: A 2025 NIS...Pfeiffer "Secrets to Changing Behavior in Scholarly Communication: A 2025 NIS...
Pfeiffer "Secrets to Changing Behavior in Scholarly Communication: A 2025 NIS...
National Information Standards Organization (NISO)
 
How to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 SalesHow to Create Quotation Templates Sequence in Odoo 18 Sales
How to Create Quotation Templates Sequence in Odoo 18 Sales
Celine George
 
Rose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdfRose Cultivation Practices by Kushal Lamichhane.pdf
Rose Cultivation Practices by Kushal Lamichhane.pdf
kushallamichhame
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptxAnalysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18How to Create a Rainbow Man Effect in Odoo 18
How to Create a Rainbow Man Effect in Odoo 18
Celine George
 
Unit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptxUnit 3 Poster Sketches with annotations.pptx
Unit 3 Poster Sketches with annotations.pptx
bobby205207
 
Nice Dream.pdf /
Nice Dream.pdf                              /Nice Dream.pdf                              /
Nice Dream.pdf /
ErinUsher3
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdfFEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
FEBA Sofia Univercity final diplian v3 GSDG 5.2025.pdf
ChristinaFortunova
 
How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18How to Manage Upselling of Subscriptions in Odoo 18
How to Manage Upselling of Subscriptions in Odoo 18
Celine George
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptxIDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
Unit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdfUnit- 4 Biostatistics & Research Methodology.pdf
Unit- 4 Biostatistics & Research Methodology.pdf
KRUTIKA CHANNE
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_HyderabadWebcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 

C programming array & shorting

  • 6. #include<stdio.h> #include<conio.h> void main() { int arr[10], i; clrscr(); printf(“Enter Array Elementn”); for(i=0;i<10;i++) { scanf(“%d”, &arr[i]); } printf(“Array Elementn”); for(i=0;i<10;i++) { printf(“%dn”,arr[i]); } getch(); } EXTRA
  • 10. EXTRA
  • 11. EXTRA
  • 12. #include<stdio.h> #include<conio.h> void main() { int arr[100], s, i , j, temp; clrscr(); printf(“Enter Array Sizen”); scanf(“%d”,&s); printf(“Enter Array Elementn”); for(i=0;i<s;i++) { scanf(“%d”, &arr[i]); } printf(“Array Element befor sortingn”); for(i=0;i<s;i++) { printf(“%dn”, arr[i]); } EXTRA
  • 13. for(i=0;i<s-1;i++) { for(j=0;j<s-1-i;j++) { if(arr[j]>arr[j+1]) { temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; } } } printf(“Data after sorting n”); for(i=0;i<s;i++) { printf(“%dn”, arr[i]); } getch(); } EXTRA
  • 14. EXTRA
  • 15. #include<stdio.h> #include<conio.h> void main() { int arr[100], s, i , j, temp; clrscr(); printf(“Enter Array Sizen”); sxcanf(“%d”,&s); printf(“Enter Array Elementn”); for(i=0;i<s;i++) { scanf(“%d”, &arr[i]); } printf(“Array Element befor sortingn”); for(i=0;i<s;i++) { printf(“%dn”, arr[i]); } EXTRA
  • 16. for(i=0;i<s-1;i++) { for(j=i+1;j<s;j++) { if(arr[i]>arr[j]) { temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; } } } printf(“Data after sortingn”); for(i=0;i<s;i++) { printf(“%dn”,arr[i]); } getch(); } EXTRA
  • 17. EXTRA
  • 18. EXTRA
  • 19. #include<stdio.h> #include<conio.h> void main() { int arr[10],s, p, temp,i,k; clrscr(); printf("enter Array Sizen"); scanf("%d",&s); printf("Enter Array Elementn"); for(i=0;i<s;i++) { scanf("%d",&arr[i]); } printf("Array Elementn"); for(i=0;i<s;i++) { printf("%dn",arr[i]); } EXTRA
  • 20. for(i=1;i<s;i++) { p=i-1; temp=arr[i]; while(temp<arr[p]&&p>=0) { arr[p+1]=arr[p]; p--; } arr[p+1]=temp; } printf("Data after sortingn"); for(i=0;i<s;i++) { printf("%dn",arr[i]); } getch(); } EXTRA
  • 21. Searching Linear Search Binary Search EXTRA Linear Search- This is the simplest technique to find out an element in an unsorted list. In this technique the value of the key is compared with the first element of the list, if match is found then the search is terminated. Otherwise next element from the list is fetched and compared with the key and this process is continued till the key is found or list is completely.
  • 22. EXTRA Binary Search- Binary search works for sorted lists and is a very efficient searching technique. It is used to find the location of a given element or record in a list. Other information associated with the element can also be fetched if required. To find the location of a file in the computer directory one can use this searching technique. Let low represents lower limit of the list l, high upper and mid is average of low and high that is middle of the lower and upper limits. Mid = (low+high)/2; we compare the middle element with key to be searched. If the value of middle element is greater than key ,then key will exit in lower half of the list, take high = mid-1 and find new value of mid.
  • 23. #include<stdio.h> #include<conio.h> void main() { int arr[100],s, i, first=0, mid=0, last =0, count =0, num; clrscr(); printf(“Enter Array Sizen”); scanf(“%d”,&s); printf(“Enter Array Elementn”); for(i=0;i<s;i++) { scanf(“%d”,&arr[i]); } printf(“Array Elementn”); for(i=0;i<s;i++) { printf(“%dn”,arr[i]); } EXTRA
  • 24. printf(“Enter the no want to search n”); scanf(“%d”,&num); last = s-1; while((first<=last)&&(count==0)) { mid=(first+last)/2; if(arr[i]==num) { count=mid; } else if(arr[i]<num) { first=mid+1; } else { last=mid-1; } } EXTRA
  • 25. if(count>0) { printf(“No found”); } else { printf(“No not found”); } getch(); } EXTRA
  • 26. Double Dimension Array #include<stdio.h> #include<conio.h> void main() { int arr[3][3], i, j; clrscr(); printf(“Enter Array Elementn”); for(i=0;i<3;i++) { for(j=0;j<3;j++) { scanf(“%d”,&arr[i][j]); } } printf(“Matrix nn”); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf(“%d ”,arr[i][j]); } printf(“n”); } getch(); } EXTRA