Jump to content

Dynamic problem (algorithms): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Created page with ''''Dynamic problems''' in computational complexity theory are problems stated in terms of the changing input data. In the most general form a problem in this ca...'
 
tag as one source
 
(31 intermediate revisions by 20 users not shown)
Line 1: Line 1:
{{Distinguish|Dynamic programming}}
'''Dynamic problems''' in [[computational complexity theory]] are problems stated in terms of the changing input data. In the most general form a problem in this category usually stated as follows:
{{one source |date=April 2024}}
'''Dynamic problems''' in [[computational complexity theory]] are problems stated in terms of changing input data. In its most general form, a problem in this category is usually stated as follows:
* Given a class of input objects, find efficient algorithms and data structures to answer a certain query about a set of input objects each time the input data is modified, i.e., objects are inserted or deleted.


Problems in this class have the following measures of complexity:
*Given a class of input objects, find efficient algorithms and data structures to answer a certain query about a set of input objects each time the set is modified, i.e., objects are inserted or deleted.
* '''Space'''{{snd}} the amount of [[Memory space (computational resource)|memory space]] required to store the data structure;
* '''Initialization time'''{{snd}} time required for the initial construction of the data structure;
* '''Insertion time'''{{snd}} time required for the update of the data structure when one more input element is added;
* '''Deletion time'''{{snd}} time required for the update of the data structure when an input element is deleted;
* '''Query time'''{{snd}} time required to answer a query;
* Other operations specific to the problem in question


The overall set of computations for a dynamic problem is called a '''dynamic algorithm'''.
Problems of this class have the folloiwng measures of complexity
*[[Memory space]] to store the required data structure
*Initial construction time of the data structure
*Insertion time, time required for the update of the data structure when one more input element is added
*Deletion time, time required for the update of the data structure when an input element is deleted
*Query time: time required to answer
*Other operations specific to the problem in question


Many algorithmic problems stated in terms of fixed input data (called '''static problems''' in this context) have meaningful dynamic versions.
Many algorithmic problems stated in terms of fixed input data (called '''static problems''' in this context and solved by '''static algorithms''') have meaningful dynamic versions.


==Example==
==Special cases==
'''Incremental algorithms''', or [[online algorithm]]s, are algorithms in which only additions of elements are allowed, possibly starting from empty/trivial input data.


'''Decremental algorithms''' are algorithms in which only deletions of elements are allowed, starting with the initialization of a full data structure.
''Static problem'': For a set of N numbers find the maximal one.


If both additions and deletions are allowed, the algorithm is sometimes called '''fully dynamic'''.
The problem may be easily solved in O(N) time.


==Examples==
''Dynamic problem'': for an initial set of N numbers, dynamicall maintain the maximal one when insertion and deletions are allowed.
===Maximal element===
;''Static problem'' : For a set of N numbers find the maximal one.

The problem may be solved in O(N) time.

;''Dynamic problem'' : For an initial set of N numbers, dynamically maintain the maximal one when insertion and deletions are allowed.


A well-known solution for this problem is using a [[self-balancing binary search tree]]. It takes space O(N), may be initially constructed in time O(N log N) and provides insertion, deletion and query times in O(log N).
A well-known solution for this problem is using a [[self-balancing binary search tree]]. It takes space O(N), may be initially constructed in time O(N log N) and provides insertion, deletion and query times in O(log N).


The ''[[priority queue]]'' maintenance problem is a simplified version of this dynamic problem, where one equires to delete only the maximal element. This version may do with simpler data structures.
;''The [[priority queue]] maintenance problem'': It is a simplified version of this dynamic problem, where one requires to delete only the maximal element. This version may do with simpler data structures.

===Graphs===
Given a graph, maintain its parameters, such as connectivity, maximal degree, shortest paths, etc., when insertion and deletion of its edges are allowed.<ref>[[D. Eppstein]], [[Z. Galil]], and [[Giuseppe F. Italiano|G. F. Italiano]]. "Dynamic graph algorithms". In ''CRC Handbook of Algorithms and Theory of Computation'', Chapter 22. CRC Press, 1997.</ref>


==See also==
==See also==
*[[Dynamization]]
* [[Dynamization]]
* [[Dynamic connectivity]]
* [[Kinetic data structure]]

==References==
{{Reflist}}

[[Category:Computational complexity theory]]



{{Computer-science-stub}}
[[Category:computational complexity theory]]

Latest revision as of 06:41, 29 April 2024

Dynamic problems in computational complexity theory are problems stated in terms of changing input data. In its most general form, a problem in this category is usually stated as follows:

  • Given a class of input objects, find efficient algorithms and data structures to answer a certain query about a set of input objects each time the input data is modified, i.e., objects are inserted or deleted.

Problems in this class have the following measures of complexity:

  • Space – the amount of memory space required to store the data structure;
  • Initialization time – time required for the initial construction of the data structure;
  • Insertion time – time required for the update of the data structure when one more input element is added;
  • Deletion time – time required for the update of the data structure when an input element is deleted;
  • Query time – time required to answer a query;
  • Other operations specific to the problem in question

The overall set of computations for a dynamic problem is called a dynamic algorithm.

Many algorithmic problems stated in terms of fixed input data (called static problems in this context and solved by static algorithms) have meaningful dynamic versions.

Special cases

[edit]

Incremental algorithms, or online algorithms, are algorithms in which only additions of elements are allowed, possibly starting from empty/trivial input data.

Decremental algorithms are algorithms in which only deletions of elements are allowed, starting with the initialization of a full data structure.

If both additions and deletions are allowed, the algorithm is sometimes called fully dynamic.

Examples

[edit]

Maximal element

[edit]
Static problem
For a set of N numbers find the maximal one.

The problem may be solved in O(N) time.

Dynamic problem
For an initial set of N numbers, dynamically maintain the maximal one when insertion and deletions are allowed.

A well-known solution for this problem is using a self-balancing binary search tree. It takes space O(N), may be initially constructed in time O(N log N) and provides insertion, deletion and query times in O(log N).

The priority queue maintenance problem
It is a simplified version of this dynamic problem, where one requires to delete only the maximal element. This version may do with simpler data structures.

Graphs

[edit]

Given a graph, maintain its parameters, such as connectivity, maximal degree, shortest paths, etc., when insertion and deletion of its edges are allowed.[1]

See also

[edit]

References

[edit]
  1. ^ D. Eppstein, Z. Galil, and G. F. Italiano. "Dynamic graph algorithms". In CRC Handbook of Algorithms and Theory of Computation, Chapter 22. CRC Press, 1997.