tailieunhanh - Lecture Algorithms and data structures: Chapter 32 - Review 15-30
This chapter augments your database application development skills with stored procedures and triggers. Stored procedures provide reuse of common code, while triggers provide rule processing for common tasks. Together, stored procedures and triggers support customization of database applications and improved productivity in developing database applications. | Algorithms and Data Structures (CSC112) 1 Review List Using Array Representation of Linear Array In Memory Operations on linear Arrays Traverse Insert Delete Example 2 Introduction Suppose we wish to arrange the percentage marks obtained by 100 students in ascending order In such a case we have two options to store these marks in memory: (a) Construct 100 variables to store percentage marks obtained by 100 different students, . each variable containing one student’s marks (b) Construct one variable (called array or subscripted variable) capable of storing or holding all the hundred values 3 Obviously, the second alternative is better. A simple reason for this is, it would be much easier to handle one variable than handling 100 different variables Moreover, there are certain logics that cannot be dealt with, without the use of an array Based on the above facts, we can define array as: “A collective name given to a group of ‘similar quantities’” 4 These similar quantities could be percentage marks of 100 students, or salaries of 300 employees, or ages of 50 employees What is important is that the quantities must be ‘similar’ These similar elements could be all int, or all float, or all char Each member in the group is referred to by its position in the group 5 For Example Assume the following group of numbers, which represent percentage marks obtained by five students per = { 48, 88, 34, 23, 96 } In C, the fourth number is referred as per[3] Because in C the counting of elements begins with 0 and not with 1 Thus, in this example per[3] refers to 23 and per[4] refers to 96 In general, the notation would be per[i], where, i can take a value 0, 1, 2, 3, or 4, depending on the position of the element being referred 6 Operations on linear Arrays A linear array is a list of a finite number n of homogenous data elements (data elements of the same type) Traversal: Processing each element in the list Search: Finding the location of the element with a given value or the . | Algorithms and Data Structures (CSC112) 1 Review List Using Array Representation of Linear Array In Memory Operations on linear Arrays Traverse Insert Delete Example 2 Introduction Suppose we wish to arrange the percentage marks obtained by 100 students in ascending order In such a case we have two options to store these marks in memory: (a) Construct 100 variables to store percentage marks obtained by 100 different students, . each variable containing one student’s marks (b) Construct one variable (called array or subscripted variable) capable of storing or holding all the hundred values 3 Obviously, the second alternative is better. A simple reason for this is, it would be much easier to handle one variable than handling 100 different variables Moreover, there are certain logics that cannot be dealt with, without the use of an array Based on the above facts, we can define array as: “A collective name given to a group of ‘similar quantities’” 4 These similar quantities could be .
đang nạp các trang xem trước