{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CS301-Lec38 handout - CS301 Data Structures Lecture No 38...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS301 – Data Structures Lecture No. 38 ___________________________________________________________________ Data Structures Lecture No. 38 Summary Table and Dictionaries Operations on Table ADT Implementation of Table o Unsorted Sequential Array o Sorted Sequential Array Binary Search We will discuss the concepts of Tables and Dictionaries in this lecture with special reference to the operations on Table ADT and the implementation. Tables and Dictionaries The table, an abstract data type, is a collection of rows and columns of information. From rows and columns, we can understand that this is like a two dimensional array. But it is not always a two dimensional array of same data type. Here in a table, the type of information in columns may be different. The data type of first column may be integer while the type of second column is likely to be string. Similarly there may be other different data types in different columns. So the two-dimensional array used for table will have different data types. A table consists of several columns, known as fields. These fields are some type of information. For example a telephone directory may have three fields i.e. name , address and phone number . On a computer system, the user account may have fields- user ID , password and home folder . Similarly a bank account may have fields like account number , account title , account type and balance of account . Following is a table that contains three fields (We are calling columns as fields). These three fields are name , address and phone . Moreover, there are three rows shown in the table. Name Address Phone Sohail Aslam 50 Zahoor Elahi Rd, Gulberg-4, Lahore 567-4567 Imran Ahmad 30-T Phase-IV, LCCHS, Lahore 517-2349 Salman Akhtar 131-D Model Town, Lahore 756-5678 Figure 38.1: A table having three fields. Each row of the table has a set of information in the three fields. The fields of a row are linked to each other. The row of a table is called a record. Thus the above table contains three records. It resembles to the telephone directory. There may be other fields in the phone directory like father’s name or the occupation of the user. Thus the data structure that we form by keeping information in rows and columns is called
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CS301 – Data Structures Lecture No. 38 ___________________________________________________________________ table. During the discussion on the concept of table, we have come across the word, dictionary. We are familiar with the language dictionary, used to look for different words and their meanings. But for a programmer, the dictionary is a data type. This data is in the form of sets of fields. These fields comprise data items. A major use of table is in Databases where we build and use tables for keeping information. Suppose we are developing payroll software for a company. In this case, a table for employees will be prepared. This table of employees has the name, id number, designation and salary etc of the employees. Similarly there may be other tables in this database e.g. to keep the leave record of the employees. There may be a table to keep the personal information of an employee. Then we use SQL (Structured
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}