What are data structures in programming

Data structures

Combining objects and data structures into a set of objects is a typical requirement in computer science. To solve this requirement, the following aspects must be considered:

  • Is the set of objects static or can it change? Is it dynamic?
  • Do the elements of the set form a certain order?
  • Is the position of the item in the crowd important? Does the object have to be accessible via its position?
  • Do you want to be able to add or remove items to the set at runtime?
  • Is it enough to know that an element belongs to the set?
  • Must the elements be accessed via a neighborhood relationship?
  • Do the elements have to meet a certain sorting order (e.g. lexicographical order?)
  • Is it allowed to manage duplicates in the set?

Real life examples

Which of the above criteria apply here?

  • Beer crate with beer bottles (non-alcoholics like to work with a crate of soda)
  • Exercise book with pages
  • Ring binder with pages
  • Ring binder with pages and dividers

The data structure used so far to manage objects was that field (Array). A field has the following advantages:

  • Very fast, indexed access to an object via its position in the field: O (1)
  • Constant size

These advantages are offset by the following disadvantages:

  • Elaborate insertion: O (n)
  • Field must be copied over when enlargement is necessary.

The reference is the second data structure with which objects can be managed. However, it only allows direct access to a single object.

To manage any number of objects, dynamic data structures in Java are used that are obtained by linking objects with object references.

The data structures are dynamic because any number of objects can be inserted or removed from them during runtime. The number of their objects (nodes) is not determined in advance.

node
A node is part of a linked, dynamic data structure. In Java, nodes are realized through objects and references that point to the nodes

Chained data structures can be linear (not branched) or branched.

  • Linear data structures are typically lists, queues, stacks
  • Branched data structures are typically found in trees

Representative of dynamic data structures

Anonymous (not verified)

Sun, 06/19/2016 - 16:33

Permalink

typo

introduction

[...] To solve thisr Requirement, the following aspects must be considered:

  • Is the set of objects static or can [you] yourself change? Is it dynamic?
  • [...]
  • Is it allowed to have duplicates in the set too manage?

[...]