Summary

This document provides an overview of fundamental computer science concepts. It defines data types, records, arrays, and related terms such as identifiers, search algorithms, and data structures. The document also includes examples to clarify the concepts discussed.

Full Transcript

UNIT 10 : Data types and structures **Data types and records** **Data type --** a classification attributed to an item of data, which determines the types of value it can take and how it can be used. **Identifier --** a unique name applied to an item of data. **Record (data type) --** a composit...

UNIT 10 : Data types and structures **Data types and records** **Data type --** a classification attributed to an item of data, which determines the types of value it can take and how it can be used. **Identifier --** a unique name applied to an item of data. **Record (data type) --** a composite data type comprising several related items that may be of different data types. **Composite data type --** a data type constructed using several of the basic data types available in a particular programming language. **Array --** a data structure containing several elements of the same data type. **Index (array) --** a numerical indicator of an item of data's position in an array. **Lower bound --** the index of the first element in an array, usually 0 or 1. **Upper bound --** the index of the last element in an array. **Linear search --** a method of searching in which each element of an array is checked in order. **Bubble sort --** a method of sorting data in an array into alphabetical or numerical order by comparing adjacent items and swapping them if they are in the wrong order. **File --** a collection of data stored by a computer program to be used again. **Abstract data type (ADT) --** a collection of data and a set of operations on that data. **Stack --** a list containing several items operating on the last in, first out (LIFO) principle. **Queue --** a list containing several items operating on the first in, first out (FIFO) principle. **Linked list --** a list containing several items in which each item in the list points to the next item in the list. **[Data types]** Data types allow programming languages to provide different classifications for items of data, so they can be used for different purposes. In pseudocode and some programming languages, before data can be used, the type needs to be decided. This is done by declaring the data type for each item to be used. Each data item is identified by a unique name, called an identifier. In pseudocode, a declaration statement takes this form: ![](media/image2.png) **[Records]** Records are composite data types formed by the inclusion of several related items that may be of different data types. This allows a programmer to refer to these items using the same identifier, enabling a structured approach to using related items. A record will contain a fixed number of items. In pseudocode, a record data type definition takes the following form: **Arrays** An array is a data structure containing several elements of the same data type; these elements can be accessed using the same identifier name. The position of each element in an array is identified using the array's index. Arrays can be one-dimensional or multi-dimensional. **[1D arrays]** A 1D array can be referred to as a list. Here is an example of a list with nine elements and a lower bound of zero. ![](media/image4.png)

Use Quizgecko on...
Browser
Browser