ArticleslgStudy

science

Longest alternating subsequence

Longest alternating subsequence is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Longest alternating subsequence rather than just read about it. In short: In combinatorial mathematics, probability, and computer science, in the longest alternating subsequence problem, one wants to find a subsequence of a given sequence in which the elements are in alternating order, and in which the sequence is as long as possible. Formally, if x = { x 1 , x 2 , … , x n } {\displaystyle \mathbf {x} =\{x_{1},x_{2},\ldots ,x_{n}\}} is a sequence of distinct real numbers, then the subsequ…

Key takeaways

  • Longest alternating subsequence belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Longest alternating subsequence to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Longest alternating subsequence from memory before moving on to harder problems.

Reference excerpt

In combinatorial mathematics, probability, and computer science, in the longest alternating subsequence problem, one wants to find a subsequence of a given sequence in which the elements are in alternating order, and in which the sequence is as long as possible. Formally, if x = { x 1 , x 2 , … , x n } {\displaystyle \mathbf {x} =\{x_{1},x_{2},\ldots ,x_{n}\}} is a sequence of distinct real numbers, then the subsequence { x i 1 , x i 2 , … , x i k } {\displaystyle \{x_{i_{1}},x_{i_{2}},\ldots ,x_{i_{k}}\}} is alternating (or zigzag or down-up) if

x i 1 > x i 2 < x i 3 > ⋯ x i k and 1 ≤ i 1 < i 2 < ⋯ < i k ≤ n . {\displaystyle x_{i_{1}}>x_{i_{2}}<x_{i_{3}}>\cdots x_{i_{k}}\qquad {\text{and}}\qquad 1\leq i_{1}<i_{2}<\cdots <i_{k}\leq n.}

Similarly, x {\displaystyle \mathbf {x} } is reverse alternating (or up-down) if

x i 1 < x i 2 > x i 3 < ⋯ x i k and 1 ≤ i 1 < i 2 < ⋯ < i k ≤ n . {\displaystyle x_{i_{1}}<x_{i_{2}}>x_{i_{3}}<\cdots x_{i_{k}}\qquad {\text{and}}\qquad 1\leq i_{1}<i_{2}<\cdots <i_{k}\leq n.}

Note that every sequence of length 1 is both alternating and reverse alternating. Let a s n ( x ) {\displaystyle {\rm {as}}_{n}(\mathbf {x} )} denote the length (number of terms) of the longest alternating subsequence of x {\displaystyle \mathbf {x} } . For example, if we consider some of the permutations of the integers 1,2,3,4,5, we have that

a s 5 ( 5 , 4 , 3 , 2 , 1 ) = 2 {\displaystyle {\rm {as}}_{5}(5,4,3,2,1)=2} , because there are alternating subsequences of length 2, (for example 5,4 or 5,2 or 3,1), but all subsequences of length 3 are not alternating;

a s 5 ( 1 , 2 , 3 , 4 , 5 ) = 1 {\displaystyle {\rm {as}}_{5}(1,2,3,4,5)=1} , because all subsequences of length 2 are not alternating. (actually, they are reverse alternating);

a s 5 ( 5 , 1 , 3 , 4 , 2 ) = 4 , {\displaystyle {\rm {as}}_{5}(5,1,3,4,2)=4,} because 5,1,3,2 and 5,1,4,2 and 5,3,4,2 are all alternating, and there is no alternating subsequence with more elements;

a s 5 ( 4 , 3 , 5 , 1 , 2 ) = 5 , {\displaystyle {\rm {as}}_{5}(4,3,5,1,2)=5,} because 4,3,5,1,2 is itself alternating.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Longest alternating subsequence

Start with the simplest possible case. Write down what Longest alternating subsequence claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Longest alternating subsequence before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Longest alternating subsequence ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Longest alternating subsequence

In research
Longest alternating subsequence appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Longest alternating subsequence in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Longest alternating subsequence is common in secondary-school and first-year university syllabi. It links to neighbouring topics Combinatorics, Dynamic programming, Permutations, so understanding it makes those chapters shorter.
In everyday life
Look for Longest alternating subsequence outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Longest alternating subsequence in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Longest alternating subsequence means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Longest alternating subsequence out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Longest alternating subsequence in simple terms?

In combinatorial mathematics, probability, and computer science, in the longest alternating subsequence problem, one wants to find a subsequence of a given sequence in which the elements are in alternating order, and in which the sequence is as long as possible. Formally, if x = { x 1 , x 2 , … , x…

Why does Longest alternating subsequence matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Longest alternating subsequence?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Longest alternating subsequence.

Tags

  • Combinatorics
  • Dynamic programming
  • Permutations
  • Problems on strings

Keep exploring