Presented By: Mahmoud Rafeek Alfarra

Slides:



Advertisements
Similar presentations
An Array A sequence of elements of a particular type Each element in the array has an index which gives its position in the sequence An array is declared.
Advertisements

DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Sorting A fundamental operation in computer science (many programs need to sort as an intermediate step). Many sorting algorithms have been developed Choose.
 Sort: arrange values into an order  Alphabetical  Ascending numeric  Descending numeric  Does come before or after “%”?  Two algorithms considered.
CS 206 Introduction to Computer Science II 04 / 28 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 12 / 09 / 2009 Instructor: Michael Eckmann.
Insertion sort, Merge sort COMP171 Fall Sorting I / Slide 2 Insertion sort 1) Initially p = 1 2) Let the first p elements be sorted. 3) Insert the.
CS 206 Introduction to Computer Science II 12 / 05 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 12 / 08 / 2008 Instructor: Michael Eckmann.
Week 11 Sorting Algorithms. Sorting Sorting Algorithms A sorting algorithm is an algorithm that puts elements of a list in a certain order. We need sorting.
Computer Programming 2 Lecture 2: Advanced Array Data Structure Using Methods Prepared & Presented by: Mahmoud Rafeek Alfarra MINISTRY OF EDUCATION & HIGHER.
Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Lecture 6 Introduction to classes and objects.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Computer Programming 2 Lecture 3: Methods in Advanced & Practices Prepared & Presented by: Mahmoud Rafeek Alfarra MINISTRY OF EDUCATION & HIGHER EDUCATION.
Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Lecture 7 Decision Making : selection statements.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Computer Programming 2 Lecture 1: Advanced Array Data Structure Using Methods Prepared & Presented by: Mahmoud Rafeek Alfarra MINISTRY OF EDUCATION & HIGHER.
Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Introduction To Programming Information Technology , 1’st Semester
Sorting. Algorithms Sorting reorders the elements in an array or list in either ascending or descending order. Sorting reorders the elements in an array.
Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Lecture 9 & 10 Repetition Statements.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Using Java MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Lecture 18 Recursion & Pointers in Java.
DATA STRUCTURE Presented By: Mahmoud Rafeek Alfarra Using C# MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE.
Sorting Chapter 14.
CS212: Data Structures and Algorithms
char first[10]="monkey"; char second[10]="fish"; char* keep;
Presented By: Mahmoud Rafeek Alfarra
Two-Dimensional Arrays
Merging Merge. Keep track of smallest element in each sorted half.
Presented By: Mahmoud Rafeek Alfarra
ㅎㅎ Fourth step for Learning C++ Programming Two functions
Bubble Sort Bubble sort is one way to sort an array of numbers. Adjacent values are swapped until the array is completely sorted. This algorithm gets its.
Introduction To Programming Information Technology , 1’st Semester
Selection Sort Find the smallest value in the array. Put it in location zero. Find the second smallest value in the array and put it in location 1. Find.
Part a: Fundamentals & Class String
Unit-2 Divide and Conquer
Presented By: Mahmoud Rafeek Alfarra
MSIS 655 Advanced Business Applications Programming
Straight Selection Sort
Introduction To Programming Information Technology , 1’st Semester
Lab 4: C Array Review: Array Lab assignments.
Chapter 11 Data Structures.
Search,Sort,Recursion.
Introduction To Programming Information Technology , 1’st Semester
Presented By: Mahmoud Rafeek Alfarra
Given value and sorted array, find index.
Multidimensional array
A G L O R H I M S T A Merging Merge.
Quadratic Sorts & Breaking the O(n2) Barrier
Presented By: Mahmoud Rafeek Alfarra
Introduction To Programming Information Technology , 1’st Semester
Data Structures & Algorithms
EECE.2160 ECE Application Programming
Exercise 5 1. We learned bubble sort during class. This problem requires you to modify the code for bubble sorting method to implement the selection sorting.
A G L O R H I M S T A Merging Merge.
A G L O R H I M S T A Merging Merge.
Lecture No 5A Advance Analysis of Institute of Southern Punjab Multan
Insertion Sort Array index Value Insertion sort.
ㅎㅎ Fourth step for Learning C++ Programming Call by value
ICS103: Programming in C Searching, Sorting, 2D Arrays
Applications of Arrays
Chapter 6 - Arrays Outline Multiple-Subscripted Arrays.
Presentation transcript:

Presented By: Mahmoud Rafeek Alfarra MINISTRY OF EDUCATION & HIGHER EDUCATION COLLEGE OF SCIENCE AND TECHNOLOGY KHANYOUNIS- PALESTINE Data structure Using C# Information Technology , 3’rd Semester Lecture 4: Multiple-Subscripted Arrays & Advanced Practices about array data structure Presented By: Mahmoud Rafeek Alfarra

Outline Multiple-Subscripted Arrays data structure Emank X Mezank !! Sorting Searching Inserting Deleting Advanced practices Emank X Mezank !!

Multiple-Subscripted Arrays Such arrays require two or more subscripts to identify particular elements. Presented & Prepared by: Mahmoud R. Alfarra

Sorting 1 2 3 4 2 77 7 9 8 1 55 12 56 10 79 2 80 81 45 90 99 3 89 87 55 4 78 Sorting Multiple-Subscripted Arrays can be done on rows or columns By row: must fix row index and increment the column index. By column: must fix col. index and increment the row index. Presented & Prepared by: Mahmoud R. Alfarra

Sorting Multiple-Subscripted Arrays By row for ( int pass = 1, pass < colLength, pass++ ) for ( int col = 0; col < colLength- 1; i++ ) if ( b[Row][col] > b[Row][ i + 1 ] ) Swap( b[Row][col], b[Row][ i + 1 ] ); HW 4.1 Write a method that performs sorting multiple-subscripted arrays by row and by col. Presented & Prepared by: Mahmoud R. Alfarra

Searching in Multiple-Subscripted Arrays 6 for ( int row = 0, row < rowLength-1, row++ ) for ( int col = 0; col < colLength- 1; col++ ) if ( b[row][col] == wanted ) flagr=row; Flagc= col; Break; HW 4.2 Write a method that performs searching multiple-subscripted arrays. Presented & Prepared by: Mahmoud R. Alfarra

Inserting element Into Multiple-Subscripted Arrays To Insert a new elements in an unsorted array, we must Shift the elements to the particular side. With fix the row or column index Presented & Prepared by: Mahmoud R. Alfarra

Deleting element from Multiple-Subscripted Arrays 8 To delete an element from an array, we must overwrite the specific element. With fix the row or column index Presented & Prepared by: Mahmoud R. Alfarra

Advanced practices 9 Use a single-subscripted array to solve the following problem: Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, print it only if it is not a duplicate of a number already read. Provide for the “worst case” (in which all 20 numbers are different). Use the smallest possible array to solve this problem. Presented & Prepared by: Mahmoud R. Alfarra

Advanced practices 10 Use a single-subscripted array to solve the following problem: Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, insert it into the particular cell as sorted as and if it is duplicated reject it. Presented & Prepared by: Mahmoud R. Alfarra

Advanced practices 11 Use a single-subscripted array to solve the following problem: insert 20 integer numbers. Then delete all the duplicated numbers Presented & Prepared by: Mahmoud R. Alfarra

يوم تكون الجبــال كالعهن المنفـوش Emank X Mezank !! يقـول الله تعالى: يوم تكون الجبــال كالعهن المنفـوش

Next Lecture Recursion