Handout 1.0 - Introduction to Data Structures.pdf

# Handout 1.0 - Introduction to Data Structures.pdf

• Notes
• 10

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

Kimani Njoroge. Data Structures. Handout 1.0 Page 1 DATA STRUCTURES INTRODUCTION What is the difference between a data type and a data structure? A data type is a well-defined collection of data with a well-defined set of operations on it. A data structure is an actual implementation of a particular abstract data type. Example: The abstract data type Set has the operations EmptySet(S), Insert(x,S), Delete(x,S), Intersection(S1,S2), Union(S1,S2), MemberQ(x,S), EqualQ(S1,S2), SubsetQ(S1,S2). This semester, we will learn to implement such abstract data types by building data structures from arrays, linked lists, etc. Subsequently, we shall use the following definitions as our basis of our discussion; A data structure is the organization of data in a computer's memory or in a disk file. The correct choice of data structure allows major improvements in program efficiency. Examples of data structures are arrays, stacks, linked lists, etc. An algorithm is a procedure for carrying out a particular task. In Java, an algorithm is usually implemented by a class method. We can hence say, algorithms are the procedures a software program uses to manipulate the data in the structures. Many of the data structures and algorithms are often used to build databases. Why Data Structures? There are three important ideas which must be mastered to write efficient programs. Iteration - Do, While, Repeat, If Data Representation - variables and pointers Subprograms and Recursion - modular design and abstraction NB : At this point, it is expected that you have mastered about 1.5 of these 3. Programming Control Structures: IF-THEN, IF-THEN-ELSE, CASE-OF, SWITCH Iteration Constructs: REPEAT-UNTIL (at least once), WHILE-DO (at least 0), FOR-DO (exactly n times). Elementary Data Types: INTEGER, REAL, BOOLEAN, CHAR Enumerated Types: COINSIDE = {HEADS, TAIL, SIDE} Operations: +, -, <, >, # Elementary Data Structures Arrays – Arrays let you access lots of data fast. You can have arrays of any data type. However, you cannot make arrays bigger if your program decides it needs more space. Database – Refers to all data used in a particular situation. Records – Records let you organize non-homogeneous data into logical packages to keep everything together. These packages do not include operations, just data fields. Thus the need of studying objects.

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

Kimani Njoroge. Data Structures. Handout 1.0 Page 2 Records do not help you process distinct items in loops, which is why arrays of records are used. They are units into which a database is divided. Records provides a format for storing information. A record includes all the information about some entity, in a situation in which there are many such entities. Field – A record is usually divided into several fields. A field holds a particular kind of data.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern