SlideShare uma empresa Scribd logo
1 de 23
SEMINAR  ON   ARRAYS UNDER THE GUIDENCE OF- Ms. PINKI MA’M PREPARED BY- SAURABH SHUKLA & SAURABH VYAS B.E. 2 nd  Yr.  1Vth Sem
11/01/11 ARRAYS INTRODUCTION  AND  CHARACTERISTICS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],TYPES ,[object Object],[object Object],[object Object],[object Object],[object Object]
11/01/11 DECLARATION OF ONE DIMENSIONAL ARRAY Data_type var_name[Expression] Data Type  is the type of elements to be stored in the array Var_name  is the name of the array like any  Other variables  Expression  specifies the number of elements to be stored  In array Example  int num[10];   Num[0] =data1 Num[1] =data2 Num[2] =data3 Num[3] =data4 Num[4] =data5 Num[5] =data6 Num[6] =data7 Num[7] =data8 Num[8] =data9 Num[9] =data10
11/01/11 ACCESSING ONE DIMENSIONAL ARRAY ELEMENTS #<Include<stdio.h> #include<conio.h> Void main()  {  Int a[10];  Clrscr();  Printf (“enter the array”); For (i=0;i<10;i++)  {  Scanf(“%d”,&a[i]); }   Printf(“the entered array is”); For(i=0;i<10;i++)  {  printf(“%d”,a[i]);} }   getch();  }   Arrray  declaration  Taking values from user Printing the values OUTPUT Enter the array 1 2 3 4 5 6 7 8 9 10 Entered array is 1 2 3 4 5 6 7 8 9 10
11/01/11 OPERATIONS  IN  ARRAY ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
11/01/11 ALGORITHM ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],INSERTION
11/01/11 INSERTION Int i,len,pos,num; Void main() {  int a[10]; Void insert (int a[ ],int,int,int); Printf(“enter integers to be read”); Scanf(“%d”,&len); Printf(:enter ur array”); For(i=0;1<len;i++) { scanf(“%d”,&a[i]); } Printf(:enter position”); Scanf(“%d”,&pos); --pos; Printf(:enter integer to be inserted”); Scanf(“%d”,&num); Insert(a,len,pos,num);} For(i=len;1pos;i--) {a[i+1])=a[i]; } A{pos]=num; Len ++; Printf(“new array is ”); For(i=0;i<len;i++) { printf(“%d”,&a[i]); }   } ORIGINAL ARRAY 1  2  3  4  5  6  7  8 HOW IT WORKS ENTER POSITION   4 ENTER NUM   9 DURING PROCESSING 1  2  3  ……..  4  5  6  7  8 NEW ARRAY 1  2  3  …9….  4  5  6  7  8 THE  ACTUAL 4 th  POSITION
11/01/11 ALGORITHM ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],DELETION
11/01/11 DELETION Int i,n; Void main() {   Int a[10],pos; Void delete(int a[ ],int,int); Printf(“enter no of elements in array”); Scanf(“%d”,&n); Printf(“enter ur array”); For(i=0;i<n;i++) Scanf(“%d”,&a[i]); Printf(:enter position”); Scanf(“%d”,&pos); --pos; delete(a[ ],pos,n);  Void delete(int a [ ],int pos,int n) {  int j item; Item =a[pos]; For(j=pos;j<n;j++) a[j]=a[j+1]; n=n-1;  } For(i=0;i<n;i++) printf(“%d”,&a[i]);  } HOW IT WORKS ORIGINAL ARRAY 1  2  3  4  5  6  7  8 ENTER POSITION   4 DURING PROCESSING 1  2  3  4  5  6  7  8 NEW ARRAY 1  2  3  5  6  7  8 THE  ACTUAL 4 th  POSITION
11/01/11 ALGORITHM Letr LB be the lower bound andUB be the  upper bound of linear array a 1. [initialize the counter]  Set I at lower bound LB  2. Repeat for i=LB to UB  [visit element]Display element a[i] [end of the loop] 3. EXIT  TRAVERSING
11/01/11 TRAVERSING AN ARRAY #include<stdio.h> Void main ( ) { Int i,n,a[10]; printf)(“enter length of the array”); Scanf(“%d”,&n); Printf(“enter ur array”); For(i=0;i<n;i++) Scanf(“%d”,&a [ i ]); Printf(“traversing the array”); For(i=0;i<n;i++) printf(“%d”,&a [ i ]); } OUTPUT 1 2 3 4 5 TRAVERSING THE ARRAY ENTER UR ARRAY 1  2  3  4  5  ENTER LENGTH OF ARRAY  5
11/01/11 MERGING OF THE TWO ARRAYS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
11/01/11 void main() { int a[10],b[10],c[10],i,j,k=0,l,m,n; cout<<&quot;Enter sizeof array1 and array2” ;    cin>>m>>n;    cout<<&quot;Enter elements of 1st:&quot;;  for(i=0;i<m;i++) {cin>>a[i];}  cout<<&quot;Elements of 2nd list:&quot;;  for(i=0;i<n;i++)  {cin>>b[i];}   for(i=0;i<m;i++)  {c[i]=a[i];}  for(j=0;j<n;j++)  {c[j+m]=b[j];}  for(i=0;i<(m+n);i++) {for(j=0;j<(m+n);j++) {if(c[i]<c[j]) {k=c[j];  c[j]=c[i]; c[i]=k; }}} cout<<&quot;New merged array :&quot;; for(i=0;i<(m+n);i++) {cout<<c[i]<<&quot;&quot;;} } PROGRAM OUTPUT Enter size of array1 and array2  5 6 Enter elements of 1 st: 5 9 16 50 80 Elements of 2 nd  list: 11 32 49 58 75 98 New merged array : 5 9 11 16 32 49 50 58 75 80 98
11/01/11 ALGORITHM SEARCHING ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
11/01/11 SEARCHING Int i,n; Void main() {   Int a[10],pos=-1,k; Printf(“enter no of elements in array”); Scanf(“%d”,&n); Printf(“enter ur array”); For(i=0;i<n;i++) Scanf(“%d”,&a[i]); Printf(:enter no. to be searched :”); Scanf(“%d”,&k);   For(j=0;j<n;j++) {if (k==a[j]) {pos=i; break;}  } If (pos>=0) printf(“%d is found in position %d”,k,pos+1); Else printf(“element does not exist”); getch();  } OUTPUT Enter no of elements in array: 6 Enter ur array: 10 20 30 40 50 60 Enter no to be searched : 50 50 is found in position 5 OUTPUT Enter no of elements in array: 6 Enter ur array: 10 20 30 40 50 60 Enter no to be searched : 45 Element does not exist
11/01/11 SORTING ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],TYPES 1.BUBBLE SORT  2.SELECTION SORT 3.INSERTION SORT  4.QUICK SORT  5.MEARGE SORT  etc.
11/01/11 SELECTION   SORTINNG ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
11/01/11 PROGRAM #include<stdio.h> void main() { int a[10],i,n,j,x; printf(&quot;enter the value of n  &quot;); scanf(&quot;%d&quot;,&n); printf(&quot;enter array  &quot;); for(i=0;i<n;i++) { scanf(&quot;%d&quot;,&a[i]);} printf(&quot; ur  unsorted array is  &quot;); for(i=0;i<n;i++) { printf(&quot;%d  &quot;,a[i]);} for(i=0;i<n;i++) {  for(j=0;j<n;j++) {  if(a[j]>a[i]) {  x=a[i]; a[i]=a[j]; a[j]=x;  }  } } printf(&quot; ur sorted  array  is &quot;); for(j=0;j<n;j++) {printf(&quot;%d  &quot;,a[j]);} } SELECTION SORTING
11/01/11 interchange 16 13 15 EXAMPLE ENTERED ARRAY a[0] a[1] a[2] a[3] a[4] 6 PASS 1 13 16 6 2 15 PASS 2 13 16 15 2 6 PASS 3  16 13 15 2 6 PASS 4 15 13 16 2 6 PASS 5 13 2 6 16 15 2
11/01/11 BUBBLE SORTING ,[object Object],[object Object],[object Object],[object Object],[object Object],EXAMPLE INITIAL ELEMENTS (without sorting) 11  15  2  13  6
11/01/11 EXAMPLE > 11 13 ENTERED ARRAY a[0] a[1] a[2] a[3] a[4] 6 PASS 1 6 13 15 11 2 PASS 2 13 6 15 2 11 PASS 3  11 13 15 2 6 PASS 4 13 11 15 2 6 RESULT 13 2 6 11 15 2 < > > > < > < < > < < < < < < 15
11/01/11 LIMITATIONS OF  LINEAR ARRAYS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
11/01/11 FROM  SAURABH SHUKLA  &  SAURABH  VYAS

Mais conteúdo relacionado

Mais procurados

Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structureSajid Marwat
 
Abstract class in c++
Abstract class in c++Abstract class in c++
Abstract class in c++Sujan Mia
 
Datastructures in python
Datastructures in pythonDatastructures in python
Datastructures in pythonhydpy
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESSowmya Jyothi
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm KristinaBorooah
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms ManishPrajapati78
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Appili Vamsi Krishna
 
Array data structure
Array data structureArray data structure
Array data structuremaamir farooq
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayimtiazalijoono
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy TutorialAfzal Badshah
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to ArraysTareq Hasan
 

Mais procurados (20)

Linked List
Linked ListLinked List
Linked List
 
Hash map
Hash mapHash map
Hash map
 
Lec 17 heap data structure
Lec 17 heap data structureLec 17 heap data structure
Lec 17 heap data structure
 
Abstract class in c++
Abstract class in c++Abstract class in c++
Abstract class in c++
 
Selection sorting
Selection sortingSelection sorting
Selection sorting
 
Binary Search
Binary SearchBinary Search
Binary Search
 
Datastructures in python
Datastructures in pythonDatastructures in python
Datastructures in python
 
Red black tree
Red black treeRed black tree
Red black tree
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
 
Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm Arrays in Data Structure and Algorithm
Arrays in Data Structure and Algorithm
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
AVL Tree
AVL TreeAVL Tree
AVL Tree
 
Heaps
HeapsHeaps
Heaps
 
Data Structure and Algorithms
Data Structure and Algorithms Data Structure and Algorithms
Data Structure and Algorithms
 
Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional Arrays 1D and 2D , and multi dimensional
Arrays 1D and 2D , and multi dimensional
 
Array data structure
Array data structureArray data structure
Array data structure
 
Array Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional arrayArray Introduction One-dimensional array Multidimensional array
Array Introduction One-dimensional array Multidimensional array
 
linked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutoriallinked list in Data Structure, Simple and Easy Tutorial
linked list in Data Structure, Simple and Easy Tutorial
 
Java: Introduction to Arrays
Java: Introduction to ArraysJava: Introduction to Arrays
Java: Introduction to Arrays
 
single linked list
single linked listsingle linked list
single linked list
 

Destaque (8)

Array in C
Array in CArray in C
Array in C
 
Arrays
ArraysArrays
Arrays
 
Dbs3024 biz trx week 2 double entry system
Dbs3024 biz trx week 2 double entry systemDbs3024 biz trx week 2 double entry system
Dbs3024 biz trx week 2 double entry system
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
 
Double entry system
Double entry systemDouble entry system
Double entry system
 
Double entry systme
Double entry systmeDouble entry systme
Double entry systme
 
Double Entry
Double EntryDouble Entry
Double Entry
 
Array in c language
Array in c languageArray in c language
Array in c language
 

Semelhante a Array Presentation (EngineerBaBu.com)

PPT.pptx Searching and Sorting Techniques
PPT.pptx Searching and Sorting TechniquesPPT.pptx Searching and Sorting Techniques
PPT.pptx Searching and Sorting TechniquesVaibhav Parjane
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manualnikshaikh786
 
INDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptxINDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptxAbhimanyuChaure
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arraysmaamir farooq
 
Array 31.8.2020 updated
Array 31.8.2020 updatedArray 31.8.2020 updated
Array 31.8.2020 updatedvrgokila
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7Kumar
 
Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)mailmerk
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applicationsAhsan Mansiv
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File Harjinder Singh
 

Semelhante a Array Presentation (EngineerBaBu.com) (20)

PPT.pptx Searching and Sorting Techniques
PPT.pptx Searching and Sorting TechniquesPPT.pptx Searching and Sorting Techniques
PPT.pptx Searching and Sorting Techniques
 
Sorting
SortingSorting
Sorting
 
Data structure lab manual
Data structure lab manualData structure lab manual
Data structure lab manual
 
INDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptxINDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptx
INDIAN INSTITUTE OF TECHNOLOGY KANPUR ESC 111M Lec12.pptx
 
Sorting
SortingSorting
Sorting
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
 
stacks and queues
stacks and queuesstacks and queues
stacks and queues
 
04 stacks
04 stacks04 stacks
04 stacks
 
SlideSet_4_Arraysnew.pdf
SlideSet_4_Arraysnew.pdfSlideSet_4_Arraysnew.pdf
SlideSet_4_Arraysnew.pdf
 
Array 31.8.2020 updated
Array 31.8.2020 updatedArray 31.8.2020 updated
Array 31.8.2020 updated
 
Data structure lecture7
Data structure lecture7Data structure lecture7
Data structure lecture7
 
Arrays
ArraysArrays
Arrays
 
DSA - Array.pptx
DSA - Array.pptxDSA - Array.pptx
DSA - Array.pptx
 
Introduction to Erlang
Introduction to ErlangIntroduction to Erlang
Introduction to Erlang
 
DAA Lab Work.docx
DAA Lab Work.docxDAA Lab Work.docx
DAA Lab Work.docx
 
05 queues
05 queues05 queues
05 queues
 
Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)Data structure and algorithm.(dsa)
Data structure and algorithm.(dsa)
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applications
 
Data Structures Practical File
Data Structures Practical File Data Structures Practical File
Data Structures Practical File
 
Arrays
ArraysArrays
Arrays
 

Último

psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 

Último (20)

psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 

Array Presentation (EngineerBaBu.com)

  • 1. SEMINAR ON ARRAYS UNDER THE GUIDENCE OF- Ms. PINKI MA’M PREPARED BY- SAURABH SHUKLA & SAURABH VYAS B.E. 2 nd Yr. 1Vth Sem
  • 2.
  • 3. 11/01/11 DECLARATION OF ONE DIMENSIONAL ARRAY Data_type var_name[Expression] Data Type is the type of elements to be stored in the array Var_name is the name of the array like any Other variables Expression specifies the number of elements to be stored In array Example int num[10]; Num[0] =data1 Num[1] =data2 Num[2] =data3 Num[3] =data4 Num[4] =data5 Num[5] =data6 Num[6] =data7 Num[7] =data8 Num[8] =data9 Num[9] =data10
  • 4. 11/01/11 ACCESSING ONE DIMENSIONAL ARRAY ELEMENTS #<Include<stdio.h> #include<conio.h> Void main() { Int a[10]; Clrscr(); Printf (“enter the array”); For (i=0;i<10;i++) { Scanf(“%d”,&a[i]); } Printf(“the entered array is”); For(i=0;i<10;i++) { printf(“%d”,a[i]);} } getch(); } Arrray declaration Taking values from user Printing the values OUTPUT Enter the array 1 2 3 4 5 6 7 8 9 10 Entered array is 1 2 3 4 5 6 7 8 9 10
  • 5.
  • 6.
  • 7. 11/01/11 INSERTION Int i,len,pos,num; Void main() { int a[10]; Void insert (int a[ ],int,int,int); Printf(“enter integers to be read”); Scanf(“%d”,&len); Printf(:enter ur array”); For(i=0;1<len;i++) { scanf(“%d”,&a[i]); } Printf(:enter position”); Scanf(“%d”,&pos); --pos; Printf(:enter integer to be inserted”); Scanf(“%d”,&num); Insert(a,len,pos,num);} For(i=len;1pos;i--) {a[i+1])=a[i]; } A{pos]=num; Len ++; Printf(“new array is ”); For(i=0;i<len;i++) { printf(“%d”,&a[i]); } } ORIGINAL ARRAY 1 2 3 4 5 6 7 8 HOW IT WORKS ENTER POSITION 4 ENTER NUM 9 DURING PROCESSING 1 2 3 …….. 4 5 6 7 8 NEW ARRAY 1 2 3 …9…. 4 5 6 7 8 THE ACTUAL 4 th POSITION
  • 8.
  • 9. 11/01/11 DELETION Int i,n; Void main() { Int a[10],pos; Void delete(int a[ ],int,int); Printf(“enter no of elements in array”); Scanf(“%d”,&n); Printf(“enter ur array”); For(i=0;i<n;i++) Scanf(“%d”,&a[i]); Printf(:enter position”); Scanf(“%d”,&pos); --pos; delete(a[ ],pos,n); Void delete(int a [ ],int pos,int n) { int j item; Item =a[pos]; For(j=pos;j<n;j++) a[j]=a[j+1]; n=n-1; } For(i=0;i<n;i++) printf(“%d”,&a[i]); } HOW IT WORKS ORIGINAL ARRAY 1 2 3 4 5 6 7 8 ENTER POSITION 4 DURING PROCESSING 1 2 3 4 5 6 7 8 NEW ARRAY 1 2 3 5 6 7 8 THE ACTUAL 4 th POSITION
  • 10. 11/01/11 ALGORITHM Letr LB be the lower bound andUB be the upper bound of linear array a 1. [initialize the counter] Set I at lower bound LB 2. Repeat for i=LB to UB [visit element]Display element a[i] [end of the loop] 3. EXIT TRAVERSING
  • 11. 11/01/11 TRAVERSING AN ARRAY #include<stdio.h> Void main ( ) { Int i,n,a[10]; printf)(“enter length of the array”); Scanf(“%d”,&n); Printf(“enter ur array”); For(i=0;i<n;i++) Scanf(“%d”,&a [ i ]); Printf(“traversing the array”); For(i=0;i<n;i++) printf(“%d”,&a [ i ]); } OUTPUT 1 2 3 4 5 TRAVERSING THE ARRAY ENTER UR ARRAY 1 2 3 4 5 ENTER LENGTH OF ARRAY 5
  • 12.
  • 13. 11/01/11 void main() { int a[10],b[10],c[10],i,j,k=0,l,m,n; cout<<&quot;Enter sizeof array1 and array2” ; cin>>m>>n; cout<<&quot;Enter elements of 1st:&quot;; for(i=0;i<m;i++) {cin>>a[i];} cout<<&quot;Elements of 2nd list:&quot;; for(i=0;i<n;i++) {cin>>b[i];} for(i=0;i<m;i++) {c[i]=a[i];} for(j=0;j<n;j++) {c[j+m]=b[j];} for(i=0;i<(m+n);i++) {for(j=0;j<(m+n);j++) {if(c[i]<c[j]) {k=c[j]; c[j]=c[i]; c[i]=k; }}} cout<<&quot;New merged array :&quot;; for(i=0;i<(m+n);i++) {cout<<c[i]<<&quot;&quot;;} } PROGRAM OUTPUT Enter size of array1 and array2 5 6 Enter elements of 1 st: 5 9 16 50 80 Elements of 2 nd list: 11 32 49 58 75 98 New merged array : 5 9 11 16 32 49 50 58 75 80 98
  • 14.
  • 15. 11/01/11 SEARCHING Int i,n; Void main() { Int a[10],pos=-1,k; Printf(“enter no of elements in array”); Scanf(“%d”,&n); Printf(“enter ur array”); For(i=0;i<n;i++) Scanf(“%d”,&a[i]); Printf(:enter no. to be searched :”); Scanf(“%d”,&k); For(j=0;j<n;j++) {if (k==a[j]) {pos=i; break;} } If (pos>=0) printf(“%d is found in position %d”,k,pos+1); Else printf(“element does not exist”); getch(); } OUTPUT Enter no of elements in array: 6 Enter ur array: 10 20 30 40 50 60 Enter no to be searched : 50 50 is found in position 5 OUTPUT Enter no of elements in array: 6 Enter ur array: 10 20 30 40 50 60 Enter no to be searched : 45 Element does not exist
  • 16.
  • 17.
  • 18. 11/01/11 PROGRAM #include<stdio.h> void main() { int a[10],i,n,j,x; printf(&quot;enter the value of n &quot;); scanf(&quot;%d&quot;,&n); printf(&quot;enter array &quot;); for(i=0;i<n;i++) { scanf(&quot;%d&quot;,&a[i]);} printf(&quot; ur unsorted array is &quot;); for(i=0;i<n;i++) { printf(&quot;%d &quot;,a[i]);} for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(a[j]>a[i]) { x=a[i]; a[i]=a[j]; a[j]=x; } } } printf(&quot; ur sorted array is &quot;); for(j=0;j<n;j++) {printf(&quot;%d &quot;,a[j]);} } SELECTION SORTING
  • 19. 11/01/11 interchange 16 13 15 EXAMPLE ENTERED ARRAY a[0] a[1] a[2] a[3] a[4] 6 PASS 1 13 16 6 2 15 PASS 2 13 16 15 2 6 PASS 3 16 13 15 2 6 PASS 4 15 13 16 2 6 PASS 5 13 2 6 16 15 2
  • 20.
  • 21. 11/01/11 EXAMPLE > 11 13 ENTERED ARRAY a[0] a[1] a[2] a[3] a[4] 6 PASS 1 6 13 15 11 2 PASS 2 13 6 15 2 11 PASS 3 11 13 15 2 6 PASS 4 13 11 15 2 6 RESULT 13 2 6 11 15 2 < > > > < > < < > < < < < < < 15
  • 22.
  • 23. 11/01/11 FROM SAURABH SHUKLA & SAURABH VYAS