SlideShare uma empresa Scribd logo
1 de 25
1D ARRAYS POONAM WALIA KV SHALIMAR BAGH
WHAT IS 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]
NEED   FOR   AN ARRAY ,[object Object],[object Object],[object Object]
TYPES OF ARRAYS ,[object Object],[object Object]
One – Dimensional Array ,[object Object],[object Object],Base type of array Name of array No. of elements that can be stored: Can be a integer value without the sign
Ex :  MARKS [50] 0 1 2 3 49 MARKS [1] MARKS [3] . . .
ARRAY   INITIALIZATION ,[object Object],[object Object],[object Object],[object Object],[object Object]
Implementation of 1Dimensional Array in Memory  ,[object Object],[object Object],[object Object],[object Object]
Ex : What will be the adresses of element Marks[-1] and marks[2] of the following array with element size as 2 bytes and base address as 1000. Marks  -3 -2 -1 0 1 2 3 1000
SOL :  Address of Marks [I] = Base Address + ES ( I – L)  L  = -3 ES = 2 Base Address  = 1000 Address of Marks[-1]= 1000 + 2(-1-(-3))   = 1000+ 2(2)= 1004 Address of Marks[2]= 1000 + 2(2-(-3))   = 1000+ 2(5)= 1010
[object Object],[object Object],[object Object],Basic Operation on 1 Dimensional Arrays
[object Object],[object Object],[object Object],[object Object],[object Object],Linear Search or Sequential Search
Algorithm to perform a Sequential Search ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Binary Search  ,[object Object],[object Object],[object Object],[object Object],[object Object]
Algorithm to perform Binary Search ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example of a Binary Search ,[object Object],[object Object]
Binary Search Example (con't) ,[object Object],[object Object]
Binary Search Example (con't) ,[object Object],[object Object]
Binary Search: Finding the search key ,[object Object],[object Object]
Binary Search Example 2 ,[object Object],[object Object]
Binary Search Example 2 (con't) ,[object Object],[object Object]
Binary Search Example 2 (con't) ,[object Object],[object Object]
Binary Search Example 2 (con't) ,[object Object],[object Object]
Binary Search 2: search key is not found ,[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Data structure
Data structureData structure
Data structure
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
 
Python : Data Types
Python : Data TypesPython : Data Types
Python : Data Types
 
concept of Array, 1D & 2D array
concept of Array, 1D & 2D arrayconcept of Array, 1D & 2D array
concept of Array, 1D & 2D array
 
queue & its applications
queue & its applicationsqueue & its applications
queue & its applications
 
Two dimensional arrays
Two dimensional arraysTwo dimensional arrays
Two dimensional arrays
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Strings in c
Strings in cStrings in c
Strings in c
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
 
Arrays
ArraysArrays
Arrays
 
Strings in c language
Strings in  c languageStrings in  c language
Strings in c language
 
Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)Array Presentation (EngineerBaBu.com)
Array Presentation (EngineerBaBu.com)
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
Python set
Python setPython set
Python set
 
One Dimensional Array
One Dimensional Array One Dimensional Array
One Dimensional Array
 
Character Array and String
Character Array and StringCharacter Array and String
Character Array and String
 

Destaque (9)

C++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLESC++ ARRAY WITH EXAMPLES
C++ ARRAY WITH EXAMPLES
 
Array in C
Array in CArray in C
Array in C
 
1 d array
1 d array1 d array
1 d array
 
358 33 powerpoint-slides_5-arrays_chapter-5
358 33 powerpoint-slides_5-arrays_chapter-5358 33 powerpoint-slides_5-arrays_chapter-5
358 33 powerpoint-slides_5-arrays_chapter-5
 
Arrays Class presentation
Arrays Class presentationArrays Class presentation
Arrays Class presentation
 
Multidimensional array in C
Multidimensional array in CMultidimensional array in C
Multidimensional array in C
 
Basic c++ programs
Basic c++ programsBasic c++ programs
Basic c++ programs
 
01 c++ Intro.ppt
01 c++ Intro.ppt01 c++ Intro.ppt
01 c++ Intro.ppt
 
Basics of c++ Programming Language
Basics of c++ Programming LanguageBasics of c++ Programming Language
Basics of c++ Programming Language
 

Semelhante a 1 D Arrays in C++

Searching Sorting
Searching SortingSearching Sorting
Searching Sorting
guest2cb109
 
9781439035665 ppt ch09
9781439035665 ppt ch099781439035665 ppt ch09
9781439035665 ppt ch09
Terry Yoast
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdf
MCCMOTOR
 

Semelhante a 1 D Arrays in C++ (20)

Searching Sorting
Searching SortingSearching Sorting
Searching Sorting
 
Chap10
Chap10Chap10
Chap10
 
9 Arrays
9 Arrays9 Arrays
9 Arrays
 
Data Structures- Part3 arrays and searching algorithms
Data Structures- Part3 arrays and searching algorithmsData Structures- Part3 arrays and searching algorithms
Data Structures- Part3 arrays and searching algorithms
 
Searching
SearchingSearching
Searching
 
Sorting
SortingSorting
Sorting
 
advanced searching and sorting.pdf
advanced searching and sorting.pdfadvanced searching and sorting.pdf
advanced searching and sorting.pdf
 
ARRAY in python and c with examples .pptx
ARRAY  in python and c with examples .pptxARRAY  in python and c with examples .pptx
ARRAY in python and c with examples .pptx
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
arrays in c
arrays in carrays in c
arrays in c
 
MODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingMODULE 5-Searching and-sorting
MODULE 5-Searching and-sorting
 
9781439035665 ppt ch09
9781439035665 ppt ch099781439035665 ppt ch09
9781439035665 ppt ch09
 
Arrays
ArraysArrays
Arrays
 
DS Unit 1.pptx
DS Unit 1.pptxDS Unit 1.pptx
DS Unit 1.pptx
 
Arrays in C.pptx
Arrays in C.pptxArrays in C.pptx
Arrays in C.pptx
 
search_sort Search sortSearch sortSearch sortSearch sort
search_sort Search sortSearch sortSearch sortSearch sortsearch_sort Search sortSearch sortSearch sortSearch sort
search_sort Search sortSearch sortSearch sortSearch sort
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
 
Python Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdfPython Unit 5 Questions n Notes.pdf
Python Unit 5 Questions n Notes.pdf
 
Array.pdf
Array.pdfArray.pdf
Array.pdf
 
arrays.pptx
arrays.pptxarrays.pptx
arrays.pptx
 

Mais de poonam.rwalia (7)

Inheritance
InheritanceInheritance
Inheritance
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Computer Ethics
Computer EthicsComputer Ethics
Computer Ethics
 
IT
ITIT
IT
 
Benefits Of Computer Software
Benefits Of Computer SoftwareBenefits Of Computer Software
Benefits Of Computer Software
 
Internet
InternetInternet
Internet
 
GIS
GISGIS
GIS
 

Último

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
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
AnaAcapella
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Último (20)

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
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
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...
 
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Ữ Â...
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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
 
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
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
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...
 

1 D Arrays in C++

  • 1. 1D ARRAYS POONAM WALIA KV SHALIMAR BAGH
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. Ex : MARKS [50] 0 1 2 3 49 MARKS [1] MARKS [3] . . .
  • 8.
  • 9.
  • 10. Ex : What will be the adresses of element Marks[-1] and marks[2] of the following array with element size as 2 bytes and base address as 1000. Marks -3 -2 -1 0 1 2 3 1000
  • 11. SOL : Address of Marks [I] = Base Address + ES ( I – L) L = -3 ES = 2 Base Address = 1000 Address of Marks[-1]= 1000 + 2(-1-(-3)) = 1000+ 2(2)= 1004 Address of Marks[2]= 1000 + 2(2-(-3)) = 1000+ 2(5)= 1010
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.