Draft:Difference array: Difference between revisions

Content deleted Content added
Heyyo53 (talk | contribs)
Still working on this! Made some text edits to try and fit the wikipedia standards. Still a work in progress.
Citation bot (talk | contribs)
Alter: url, title, template type. URLs might have been anonymized. Add: isbn, chapter, authors 1-1. Removed URL that duplicated identifier. Removed parameters. Some additions/deletions were parameter name changes. | Use this bot. Report bugs. | #UCB_CommandLine
 
Line 9:
 
 
An array that takes a sequence of numbers <math>A=\{x_{0},x_{1},...,x_{n}\}</math> and stores the differences between each element in the array. More generally an array <math>D(A)=y_{0},y_{1},...,y_{n}</math> where <math>y_{i}=x_{i}-x_{i-1}</math>. The difference array of a sequence <math>A</math> can be denoted as <math>D(A)</math>. Commonly a difference array is use to make a series of range queries with constant [[time complexity]]<ref name=":2">{{Cite book |last=Laaksonen |first=Antti |url=https://wwwbooks.google.com/books/edition/Guide_to_Competitive_Programming/3JbiDwAAQBAJ?hlid=en&gbpv=03JbiDwAAQBAJ |title=Guide to Competitive Programming: Learning and Improving Algorithms Through Contests |date=2020-05-08 |publisher=Springer Nature |isbn=978-3-030-39357-1 |publication-date=2020-05-08 |pages=137 |language=en}}</ref><ref name=":0">{{Cite web |title=Prefix sum array and difference array - PEGWiki |url=https://wcipeg.com/wiki/Prefix_sum_array_and_difference_array |access-date=2025-05-20 |website=wcipeg.com}}</ref>
 
<math>\begin{array}{l}
Line 36:
* <math>x</math> Value to add to the elements within <math>[l,r]</math>.
 
Difference arrays are used to update arrays that are modified using [[Range Queries|range queries]] within [[constant time]].<ref name=":1">{{Cite web |last=Katiyar |first=Ishank |date=2021-07-30 |title=Understanding Difference Array: The Underrated Constant Time Range Update Algorithm (Part 1) |url=https://medium.com/@ishankkatiyar162/understanding-difference-array-the-underrated-constant-time-range-update-algorithm-part-1-e432ada7f1f5 |url-status=live |access-date=2025-05-20 |website=Medium}}</ref> initially the difference array has each element set to 0. Difference arrays when modified using a range query only require changes to the elements that lie on the bounds of the range query. So given a range query of <math>(l, r, x)</math> the elements of <math>D(A)</math> will remain unchanged except for at index <math>l</math> and <math>r + 1</math> . This allows for the entire range query to be expressed by modifying <math>A_{l}+1</math> and <math> A_{r+1}-1</math> rather than updating each element between.<ref>{{Cite web |last=Nadaf |first=Aman |date=2023-02-28 |title=Difference Array Technique |url=https://teckbakers.hashnode.dev/difference-array-technique |url-status=live |access-date=2025-05-20 |website=TeckBakers}}</ref><ref name=":2" />
 
<math>D(A)=[0,0,0,0,0] \underbrace{\to}_{(l,r,x)}
Line 62:
 
=== Steganalaysis ===
Methods of JPEG base steganography can be detected using difference arrays. It has been shown that Markov features that were extracting from zigzag intra-block and inter-block difference array improve steganography detection substantially. By calculating difference arrays along the horizontal and vertical directions of the JPEG's data array, then applying a Markov matrix to these difference arrays intra-block features are able to be constructed.<ref>{{Cite journalbook |lastlast1=Zhou |firstfirst1=Zhiping |last2=Hui |first2=Maomao |date=August 2009 |titlechapter=Steganalysis for Markov Feature of Difference Array in DCT Domain |urldate=https://ieeexplore.ieee.org/document/5360076August 2009 |journaltitle=2009 Sixth International Conference on Fuzzy Systems and Knowledge Discovery |volume=7 |pages=581–584 |doi=10.1109/FSKD.2009.230 |isbn=978-0-7695-3735-1 }}</ref>
 
== References ==