Data Structures

Types of Data Structures

  • A data structure is a way of organising and storing data in a computer so that it can be used efficiently.
  • Basic types of data structures include arrays, record, file, and list.
  • An array is a collection of elements, where each element can be identified by at least one index or key.
  • A record (also known as a structure) is a basic data structure and can be defined as a collection of fields, each of which contains only one piece of data.
  • A file is a collection of records treated as a unit. Files are used for long-term storage of large amounts of data.
  • A list or linked list is a data structure in which the objects are arranged in a linear order.

Notation of Data Structures

  • Data structures can be represented using pseudocode or flowcharts.
  • Pseudocode is a method of writing up a set of instructions for a computer program using plain English.
  • A flowchart is a type of diagram that represents an algorithm or process. The diagram represents different steps in a process using different kinds of boxed shapes connected by arrows.
  • Get comfortable with both representations as they provide different ways of visualising and understanding how a data structure works.

Data Structure Applications

  • Data structures also include stacks, queues and trees which are used in computing to carry out tasks such as running a program, storing data, routing algorithms, etc.
  • A stack is a basic data structure that can be logically thought of as a linear structure represented by a real physical stack or pile, a structure where insertion and deletion of items take place at one end called the top.
  • A queue is another basic data structure that follows the First-In-First-Out methodology (FIFO), to manage and organise its data.
  • A tree data structure has roots, branches, and leaves, but it is upside down compared to an actual tree in nature. The place where you start is called the root. When you first start, trees seem pretty complex.

Importance of Data Structures

  • Choosing the right data structure can significantly improve the efficiency of an algorithm or a program.
  • Understanding data structures enhances problem-solving ability and has implications in many areas of computer science including operating systems, database systems, and software engineering.