Lecture Algorithms and data structures: Chapter 10 - List using Array

An Abstract Deque (Deque ADT) is an abstract data structure which emphasizes specific operations: Uses a explicit linear ordering, insertions and removals are performed individually, allows insertions at both the front and back of the deque. This topic discusses the concept of a queue: Description of an Abstract Deque, applications, implementations, the STL and iterations. | Review Sorting algorithms Selection Sort Insertion Sort Bubble Sort Merge Sort Quick Sort List Using Array Introduction Representation of Linear Array In Memory Operations on linear Arrays Traverse Insert Delete Example 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 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’” 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 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 Representation of Linear Array In Memory An array occupies a continuous block of memory Each element of the array also has unique memory address Starting address of the array called base . | Review Sorting algorithms Selection Sort Insertion Sort Bubble Sort Merge Sort Quick Sort List Using Array Introduction Representation of Linear Array In Memory Operations on linear Arrays Traverse Insert Delete Example 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 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 .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.