Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.

Slides:



Advertisements
Similar presentations
Chapter 21 Implementing lists: array implementation.
Advertisements

A Short Review Arrays, Pointers and Structures. What is an Array? An array is a collection of variables of the same type and placed in memory contiguously.
UNIT IV.
Copyright © 2003 Pearson Education, Inc. Slide 1.
Copyright © 2002 Pearson Education, Inc. Slide 1.
Etter/Ingber Arrays and Matrices. Etter/Ingber One-Dimensional Arrays 4 An array is an indexed data structure 4 All variables stored in an array are of.
Chapter 8: Arrays.
The simple built-in data types of the C language such as int, float, - are not sufficient to represent complex data such as lists, tables, vectors, and.
Lab 8 User Defined Function.
Programming with Collections Collections in Java Using Arrays Week 9.
COMP102 – Programming Fundamentals I LA2B (Mon 5-7pm) LA2E (Fri 3-5pm) LA2F (Fri 5-7pm) TA: Jackie Lo.
11-1 Chapter 11 2D Arrays Asserting Java Rick Mercer.
CMPUT 101 Lab #6 October 29, :00 – 17:00. Array in C/C++ Array is a structure type variable. One dimension of array int: int num[3]; There are.
© The McGraw-Hill Companies, 2006 Chapter 5 Arrays.
CS 106 Introduction to Computer Science I 02 / 20 / 2008 Instructor: Michael Eckmann.
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
Multiple-Subscripted Array
Arrays.
LAB-12 2-D Array I Putu Danu Raharja Information & Computer Science Department CCSE - King Fahd University of Petroleum & Minerals.
CMSC 104, Version 8/061L22Arrays1.ppt Arrays, Part 1 of 2 Topics Definition of a Data Structure Definition of an Array Array Declaration, Initialization,
11-1 Chapter 11 2D Arrays Asserting Java Rick Mercer.
Arrays in C++ Numeric Character. Structured Data Type A structured data type is a type that stores a collection of individual components with one variable.
Comp 245 Data Structures Linked Lists. An Array Based List Usually is statically allocated; may not use memory efficiently Direct access to data; faster.
ARRAYS 1 Week 2. Data Structures  Data structure  A particular way of storing and organising data in a computer so that it can be used efficiently 
COMP102 Lab 081 COMP 102 Programming Fundamentals I Presented by : Timture Choi.
Arrays and ArrayLists in Java L. Kedigh. Array Characteristics List of values. A list of values where every member is of the same type. Each member in.
Chapter 8: Collections: Arrays. 2 Objectives One-Dimensional Arrays Array Initialization The Arrays Class: Searching and Sorting Arrays as Arguments The.
Two dimensional arrays in Java Computer Science 3 Gerb Objective: Use matrices in Java.
Arrays Array – Group of contiguous memory locations Each memory location has same name Each memory location has same type.
BUILDING JAVA PROGRAMS CHAPTER 7 Arrays. Exam #2: Chapters 1-6 Thursday Dec. 4th.
1 Mr. Muhammad Hanif Lecturer Information Technology MBBS Campus Dadu University of SIndh.
Computer Programming 12 Mr. Jean April 24, The plan: Video clip of the day Upcoming Quiz Sample arrays Using arrays More about arrays.
CHAPTER 7 arrays I NTRODUCTION T O C OMPUTER P ROGRAMMING (CSC425)
Week # 2: Arrays.  Data structure  A particular way of storing and organising data in a computer so that it can be used efficiently  Types of data.
Data Structure CS 322. What is an array? Initializing arrays Accessing the values of an array Multidimensional arrays LAB#1 : Arrays.
Arrays. The array data structure Array is a collection of elements, that have the same data type Integers (int) Floating point numbers (float, double)
Chapter 10 Arrays. Learning Java through Alice © Daly and Wrigley Objectives Declare and use arrays in programs. Access array elements within an array.
Introduction to Computing Concepts Note Set 21. Arrays Declaring Initializing Accessing Using with Loops Sending to methods.
CS 180 Recitation 7 Arrays. Used to store similar values or objects. An array is an indexed collection of data values of the same type. Arrays are the.
Arrays. Topics to be Covered... Arrays ◦ Declaration ◦ Assigning values ◦ Array manipulation using loops Multi-dimensional arrays ◦ 2D arrays ◦ Declaration.
Arrays An array is an indexed data structure which is used to store data elements of the same data type. An array is an indexed data structure which is.
Array contiguous memory locations that have the same name and type. Note: an array may contain primitive data BUT an array is a data structure a collection.
1 CSC103: Introduction to Computer and Programming Lecture No 17.
CS 115 OBJECT ORIENTED PROGRAMMING I LECTURE 11 GEORGE KOUTSOGIANNAKIS 1 Copyright: 2015 Illinois Institute of Technology_ George Koutsogiannakis.
Arrays – two dimensional Chapter 14 This chapter explains how to do the following with a two dimensional array: Declare, use indices, obtain size, pass.
Introduction to programming in java Lecture 21 Arrays – Part 1.
Two-Dimensional Arrays
Arrays, Part 1 of 2 Topics Definition of a Data Structure
2008/11/24: Lecture 19 CMSC 104, Section 0101 John Y. Park
Visual Basic .NET BASICS
2008/11/24: Lecture 19 CMSC 104, Section 0101 John Y. Park
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Arrays Week 2.
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Arrays I Handling lists of data.
Arrays in Java.
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Programming Arrays.
Arrays, Part 1 of 2 Topics Definition of a Data Structure
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Arrays, Part 2 of 2 Topics Array Names Hold Address How Indexing Works
Presentation transcript:

Array Cs212: DataStructures Lab 2

Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a is the name of this array Array index or subscript

Declaring, Allocating an initialize Arrays Declare array of zero (JAVA ) 1- Default Each int is initialized to 0 by default

2- Or we can use initializer List

Declare array of zero (c++) 1- using Loop 2- Or we can use initializer List OUT PUT

Initialize the array with different value using initializer list (JAVA) Output (C++)

Initialize the array with user inputs (JAVA)

Initialize the array with user inputs (C++) Output

Ex 1: Calculate value stored in each array element Initialize elements of 10-element array to even integers start the even number from 2.

Answer: (java)

Answer: (C++) Output

EX2: Array elements Can represent a series of values We can sum these values

Answer: (C++) Output

Answer: (java)