SlideShare una empresa de Scribd logo
1 de 61
Made By: Ms. Archika Bhatia ARRAYS
WHAT IS AN ARRAY ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
NEED FOR AN ARRAY ,[object Object],[object Object],[object Object]
[object Object],[object Object],TYPES OF ARRAYS Base type of array Name of array No. of elements that can be stored: Can be a integer value without the sign
Creating an Array ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Memory Representation of Single Dimension Array ,[object Object],Arr [ 0 ]  Arr [ 1 ]  Arr [ 2 ]  Arr [ 3 ]  Arr [ 4 ]  5016  5012 5008  5004  5000  Total Memory requirement is : size of ( type ) * size of array 4 * 5  = 20 bytes
ARRAY INITIALISATION ,[object Object],[object Object]
UNSIZED ARRAY INITIALISATION ,[object Object],[object Object]
Program to count the no. of employees earning more than Rs. 1 lakh per annum. Monthly salaries of 10 employees are given. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Passing arrays in a function ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
WAP to input 10 numbers in an array and replace all even no.s by 0 and odd no.s by 1 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
WAP to input 10 numbers in an array and replace all even no.s by 0 and odd no.s by 1 using functions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
WAP to find the largest and smallest no. in an array of 10 elements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
PRACTICE QUESTIONS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Give the output of the following: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
output ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Give the output of the following: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Give the output ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Find errors in the following program code: ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Find errors in the following program code: (  Assume header files included ) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Find errors in the following program code: (  Assume header files included ) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Find errors in the following program code: (  Assume header files included ) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Find errors in the following program code: (  Assume header files included ) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
SEARCHING FOR AN ELEMENT IN AN ARRAY ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Function for Linear Searching
Search for the element using Linear Search and count the no. of times the element occurs in the array. ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Binary Search method ,[object Object],[object Object],[object Object],[object Object],[object Object],m f m f l l l f f m l m l Note:  need to check f < = l
[object Object],[object Object],[object Object],[object Object],[object Object],m l l f m f l f m l
[object Object],[object Object],[object Object],[object Object],[object Object],f m l l f m f l m
INSERTING AN ELEMENT IN AN ARRAY ,[object Object],[object Object],[object Object],[object Object],Insert new element at the space created here. POS VALUE 12 13 12 10 8 7 6 6 5 4 3 2 1 0
DELETING AN ELEMENT IN AN ARRAY ,[object Object],[object Object],[object Object],[object Object],Insert 0 at the empty space created here. POS VALUE 6 5 4 3 2 1 0 12 13 12 10 8 7 6
SORTING ,[object Object],[object Object],[object Object],[object Object],[object Object]
BUBBLE SORT S NS NS S S PASS - I 9 5 6 2 4 3 5 9 6 2 4 3 5 6 9 2 4 3 5 6 2 9 4 3 5 6 2 9 4 3 5 6 2 9 4 3
BUBBLE SORT NS S NS S NS PASS - II 9 6 5 4 2 3 9 6 5 4 2 3 9 5 6 4 2 3 9 5 6 4 2 3 9 5 6 2 4 3 9 5 6 2 4 3
BUBBLE SORT NS NS S NS NS PASS - III 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 2 3
BUBBLE SORT NS NS NS NS NS PASS - IV 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2
EXCHANGE SELECTION SORT UNSORTED smallest First element of unsorted SORTED UNSORTED SORTED SORTED UNSORTED UNSORTED SORTED UNSORTED SORTED UNSORTED 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 5 6 9 4 3 2 5 6 4 9 3 2 5 6 3 9 4 2 5 6 2 9 4 3
INSERTION SORT UNSORTED First element of unsorted SORTED UNSORTED SORTED SORTED UNSORTED UNSORTED SORTED UNSORTED SORTED SORTED Find the correct place for the element and keep shifting the elements to the right. 8 7 5 3 2 2 5 8 7 3 2 2 5 2 8 7 3 2 5 2 2 8 7 3 5 2 2 3 8 7 5 2 2 3 8 7
MERGING OF TWO ARRAYS INTO A SINGLE ARRAY ,[object Object],[object Object],STEP - I 15 9 6 5 3 B  (elements) 4 3 2 1 0 B  (pos) 15 13 12 8 7 3 2 A  (elements) 6 5 4 3 2 1 0 A  (pos) C  (elements) C  (pos) 2 11 10 9 8 7 6 5 4 3 2 1 0
MUTLIDIMENSIONAL ARRAY ,[object Object],[object Object],[object Object],[object Object],[object Object]
ARRAY DECLARATION ,[object Object],[object Object],rows columns ( 1, 2 ) ( 1, 1 ) ( 1, 0 ) 1 ( 0, 2 ) ( 0 , 1 ) ( 0, 0 ) 0 2 1 0
UNSIZED ARRAY INITIALISATION ,[object Object],[object Object]
ADDRESS CALCULATION OF 1DA ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ADDRESS CALCULATION OF 2DA ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Given Array Row Major Implementation Column Major Implementation 8 7 2 6 5 3 8 7 2 6 5 3 8 6 7 5 2 3
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ADDRESS CALCULATION OF 2DA ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MULTIPLICATION OF TWO MATRICES ,[object Object],* A[3][2] B[2][4] 3 (2,1) 2 (2,0) 1 (1,1) 4 (1,0) 6 (0,1) 5 (0,0) 1 (1,3) 6 (1,2) 4 (1,1) 5 (1,0) 0 (0,3) 1 (0,2) 3 (0,1) 2 (0,0)
[object Object],* A[3][2] B[2][4] C[3][4] 3 (2,1) 2 (2,0) 1 (1,1) 4 (1,0) 6 (0,1) 5 (0,0) 1 (1,3) 6 (1,2) 4 (1,1) 5 (1,0) 0 (0,3) 1 (0,2) 3 (0,1) 2 (0,0) 2*0 + 3*1 2*1 + 3*6 2*3 + 3*4 2*2 + 3*5 4*0 + 1*1 4*1 + 1*6 4*3 + 1*4 4*2 + 1*5 5*0 + 6*1 5*1 + 6*6 5*3 + 6*4 5*2 + 6*5
TRANSPOSE OF A MATRIX ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
LOWER TRIANGLE ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UPPER TRIANGLE ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
WAP to find row and column sum of a matrix. Create input, display and row_col_sum function for the same. IP OP 9 (2,2) 8 (2,1) 7 (2,0) 6 (1,2) 5 (1,1) 4 (1,0) 3 (0,2) 2 (0,1) 1 (0,0) 0 17 14 11 21 9 8 7 15 6 5 4 6 3 2 1

Más contenido relacionado

La actualidad más candente

Array in c language
Array in c languageArray in c language
Array in c language
home
 

La actualidad más candente (20)

Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Stack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi LecturerStack and Queue by M.Gomathi Lecturer
Stack and Queue by M.Gomathi Lecturer
 
Python list
Python listPython list
Python list
 
Array in c language
Array in c languageArray in c language
Array in c language
 
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
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Arrays
ArraysArrays
Arrays
 
2D Array
2D Array 2D Array
2D Array
 
Stacks in DATA STRUCTURE
Stacks in DATA STRUCTUREStacks in DATA STRUCTURE
Stacks in DATA STRUCTURE
 
STACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURESTACKS IN DATASTRUCTURE
STACKS IN DATASTRUCTURE
 
Stack
StackStack
Stack
 
Stack and queue
Stack and queueStack and queue
Stack and queue
 
Ppt on Linked list,stack,queue
Ppt on Linked list,stack,queuePpt on Linked list,stack,queue
Ppt on Linked list,stack,queue
 
Data Structure (Stack)
Data Structure (Stack)Data Structure (Stack)
Data Structure (Stack)
 
Sets in python
Sets in pythonSets in python
Sets in python
 
Data structure by Digvijay
Data structure by DigvijayData structure by Digvijay
Data structure by Digvijay
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Data structure & its types
Data structure & its typesData structure & its types
Data structure & its types
 
Linked lists
Linked listsLinked lists
Linked lists
 

Similar a Arrays

(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
arihantelehyb
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdf
Rahul04August
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
DIPESH30
 

Similar a Arrays (20)

Arrays
ArraysArrays
Arrays
 
Arrays
ArraysArrays
Arrays
 
CBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical fileCBSE Class XII Comp sc practical file
CBSE Class XII Comp sc practical file
 
DSA.pdf
DSA.pdfDSA.pdf
DSA.pdf
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
JBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java ProgrammersJBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java Programmers
 
An Introduction to Part of C++ STL
An Introduction to Part of C++ STLAn Introduction to Part of C++ STL
An Introduction to Part of C++ STL
 
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
02 arrays
02 arrays02 arrays
02 arrays
 
C programs
C programsC programs
C programs
 
Arrays
ArraysArrays
Arrays
 
DSA - Array.pptx
DSA - Array.pptxDSA - Array.pptx
DSA - Array.pptx
 
C++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdfC++ Searching & Sorting5. Sort the following list using the select.pdf
C++ Searching & Sorting5. Sort the following list using the select.pdf
 
STL ALGORITHMS
STL ALGORITHMSSTL ALGORITHMS
STL ALGORITHMS
 
Data structure array
Data structure  arrayData structure  array
Data structure array
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
 
C program
C programC program
C program
 
Code optimization
Code optimization Code optimization
Code optimization
 
Code optimization
Code optimization Code optimization
Code optimization
 

Más de archikabhatia (10)

Computer network
Computer networkComputer network
Computer network
 
Structures
StructuresStructures
Structures
 
Wild Cards
Wild CardsWild Cards
Wild Cards
 
Console Io Operations
Console Io OperationsConsole Io Operations
Console Io Operations
 
Programming Methodology
Programming MethodologyProgramming Methodology
Programming Methodology
 
Headerfiles
HeaderfilesHeaderfiles
Headerfiles
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
 
Functions
FunctionsFunctions
Functions
 
Draw
DrawDraw
Draw
 
Cso Latest
Cso LatestCso Latest
Cso Latest
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

Arrays

  • 1. Made By: Ms. Archika Bhatia ARRAYS
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40. BUBBLE SORT S NS NS S S PASS - I 9 5 6 2 4 3 5 9 6 2 4 3 5 6 9 2 4 3 5 6 2 9 4 3 5 6 2 9 4 3 5 6 2 9 4 3
  • 41. BUBBLE SORT NS S NS S NS PASS - II 9 6 5 4 2 3 9 6 5 4 2 3 9 5 6 4 2 3 9 5 6 4 2 3 9 5 6 2 4 3 9 5 6 2 4 3
  • 42. BUBBLE SORT NS NS S NS NS PASS - III 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 2 3
  • 43. BUBBLE SORT NS NS NS NS NS PASS - IV 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2
  • 44. EXCHANGE SELECTION SORT UNSORTED smallest First element of unsorted SORTED UNSORTED SORTED SORTED UNSORTED UNSORTED SORTED UNSORTED SORTED UNSORTED 9 6 5 4 3 2 9 6 5 4 3 2 9 6 5 4 3 2 5 6 9 4 3 2 5 6 4 9 3 2 5 6 3 9 4 2 5 6 2 9 4 3
  • 45. INSERTION SORT UNSORTED First element of unsorted SORTED UNSORTED SORTED SORTED UNSORTED UNSORTED SORTED UNSORTED SORTED SORTED Find the correct place for the element and keep shifting the elements to the right. 8 7 5 3 2 2 5 8 7 3 2 2 5 2 8 7 3 2 5 2 2 8 7 3 5 2 2 3 8 7 5 2 2 3 8 7
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52. Given Array Row Major Implementation Column Major Implementation 8 7 2 6 5 3 8 7 2 6 5 3 8 6 7 5 2 3
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61. WAP to find row and column sum of a matrix. Create input, display and row_col_sum function for the same. IP OP 9 (2,2) 8 (2,1) 7 (2,0) 6 (1,2) 5 (1,1) 4 (1,0) 3 (0,2) 2 (0,1) 1 (0,0) 0 17 14 11 21 9 8 7 15 6 5 4 6 3 2 1