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

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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 fathers name or the occupation of the user. Thus the data structure that we form by keeping information in rows and columns is called 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....
View Full Document

This note was uploaded on 05/21/2010 for the course CS CS301 taught by Professor Dr.naveed malik during the Spring '10 term at Virtual University of Pakistan.

Page1 / 6

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online