<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.algopedia.ro/wiki/index.php?action=history&amp;feed=atom&amp;title=Problems_Involving_Sequences</id>
	<title>Problems Involving Sequences - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.algopedia.ro/wiki/index.php?action=history&amp;feed=atom&amp;title=Problems_Involving_Sequences"/>
	<link rel="alternate" type="text/html" href="https://www.algopedia.ro/wiki/index.php?title=Problems_Involving_Sequences&amp;action=history"/>
	<updated>2026-05-01T01:35:58Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://www.algopedia.ro/wiki/index.php?title=Problems_Involving_Sequences&amp;diff=1650&amp;oldid=prev</id>
		<title>Cristian: Add search in a sequence</title>
		<link rel="alternate" type="text/html" href="https://www.algopedia.ro/wiki/index.php?title=Problems_Involving_Sequences&amp;diff=1650&amp;oldid=prev"/>
		<updated>2011-01-13T12:59:04Z</updated>

		<summary type="html">&lt;p&gt;Add search in a sequence&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Problems with Sequences =&lt;br /&gt;
&lt;br /&gt;
This is a small list of exercises involving sequences of numbers, for beginners. They do not require storage, thus they have solutions without using arrays.&lt;br /&gt;
&lt;br /&gt;
== Problems with sequences (no arrays needed) ==&lt;br /&gt;
&lt;br /&gt;
=== Even Elements ===&lt;br /&gt;
How many even elements are in a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; integer numbers?&lt;br /&gt;
=== Signed Elements ===&lt;br /&gt;
How many negative, zero, and positive elements does a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; numbers contain?&lt;br /&gt;
=== Sum and Product ===&lt;br /&gt;
Compute the sum and the product of numbers &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; given. Is there a complexity difference between the best algorithms you can find for the two?&lt;br /&gt;
=== Find Element ===&lt;br /&gt;
Given a number &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; and a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; elements, on what position does &amp;lt;code&amp;gt;a&amp;lt;/code&amp;gt; appear in the sequence?&lt;br /&gt;
=== Indices and Elements ===&lt;br /&gt;
How many numbers in a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; elements are equal to the position in which they appear in the sequence?&lt;br /&gt;
=== Increasing Sequence ===&lt;br /&gt;
Are the numbers in a sequence in increasing order?&lt;br /&gt;
=== Maximum and minimum ===&lt;br /&gt;
Compute the maximum and the minimum value in a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; numbers.&lt;br /&gt;
=== Fibonacci numbers ===&lt;br /&gt;
Compute the &amp;lt;code&amp;gt;n&amp;lt;sup&amp;gt;th&amp;lt;/sup&amp;gt;&amp;lt;/code&amp;gt; number in the Fibonacci sequence. The Fibonacci sequence has &amp;lt;code&amp;gt;f&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; = 0&amp;lt;/code&amp;gt;,  &amp;lt;code&amp;gt;f&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; = 1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;f&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt; = f&amp;lt;sub&amp;gt;n-1&amp;lt;/sub&amp;gt; + f&amp;lt;sub&amp;gt;n-2&amp;lt;/sub&amp;gt;&amp;lt;/code&amp;gt;. Example: &amp;lt;code&amp;gt;0 1 1 2 3 5 8 13 21 ...&amp;lt;/code&amp;gt;&lt;br /&gt;
=== Monotonic Sequence ===&lt;br /&gt;
Is a sequence of numbers monotonic? We define a &amp;lt;span style=color:green&amp;gt;&amp;#039;&amp;#039;&amp;#039;monotonic sequence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; as a sequence whose numbers are either in increasing order, or in decreasing order.&lt;br /&gt;
=== Identical Numbers ===&lt;br /&gt;
What is the maximum number of consecutive identical numbers in a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; elements?&lt;br /&gt;
=== Adding fractions ===&lt;br /&gt;
Given a sequence of numbers &amp;lt;code&amp;gt;a&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; a&amp;lt;sub&amp;gt;2&amp;lt;/sub&amp;gt; ... a&amp;lt;sub&amp;gt;n&amp;lt;/sub&amp;gt;&amp;lt;/code&amp;gt; compute the summation &amp;lt;math&amp;gt;\sum_{k=1}^n \frac{1}{a_k} = \frac{1}{a_1} + \frac{1}{a_2} + ... + \frac{1}{a_n}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Word Counting ===&lt;br /&gt;
How many groups of consecutive non-zero numbers are in a sequence? Consider such groups as words, zero being a divider such as space.&lt;br /&gt;
=== Rotating Sequence &amp;lt;sup&amp;gt;h&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
Let&amp;#039;s define a &amp;lt;span style=color:green&amp;gt;&amp;#039;&amp;#039;&amp;#039;rotating increasing sequence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; as a sequence of numbers that is either in increasing order, or can be transformed into one by successive rotations (the last element becomes first). Problem: is a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; numbers a rotating increasing sequence?&lt;br /&gt;
=== Rotating Monotonic Sequence &amp;lt;sup&amp;gt;h&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
Same as before we define a &amp;lt;span style=color:green&amp;gt;&amp;#039;&amp;#039;&amp;#039;rotating monotonic sequence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; as a sequence that is either monotonic, or can be made into one by rotations. Problem: is a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; numbers a rotating monotonic sequence?&lt;br /&gt;
=== Bitonic Sequence &amp;lt;sup&amp;gt;h&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
Is a sequence of numbers bitonic? We define a &amp;lt;span style=color:green&amp;gt;&amp;#039;&amp;#039;&amp;#039;bitonic sequence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; as a sequence whose numbers are begin in increasing order, and then start decreasing and remain decreasing until the end of the sequence. Increasing and decreasing sequences are also bitonic sequences (that is, it&amp;#039;s allowed to skip one of the two sections).&lt;br /&gt;
=== Rotating Bitonic Sequence &amp;lt;sup&amp;gt;h&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
Same as before we define a &amp;lt;span style=color:green&amp;gt;&amp;#039;&amp;#039;&amp;#039;rotating bitonic sequence&amp;#039;&amp;#039;&amp;#039;&amp;lt;/span&amp;gt; as a sequence that is either bitonic, or can be made into one by rotations. Problem: is a sequence of &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; numbers a rotating bitonic sequence?&lt;br /&gt;
=== Brackets &amp;lt;sup&amp;gt;h&amp;lt;/sup&amp;gt; ===&lt;br /&gt;
Given a sequence of &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; means open bracket and &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; means close bracket, find out if the sequence represents a correct sequence of brackets, and if so, compute the maximum number of nested brackets. Example: &amp;lt;code&amp;gt;0 1 0 0 1 0 1 1&amp;lt;/code&amp;gt; is correct and has a maximum nesting factor of 2, while &amp;lt;code&amp;gt;0 0 1 1 1 0&amp;lt;/code&amp;gt; is incorrect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;Legend:&amp;#039;&amp;#039;&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;&amp;lt;sup&amp;gt;h&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;&amp;#039; means &amp;#039;&amp;#039;&amp;#039;h&amp;#039;&amp;#039;&amp;#039;ard. The problem is difficult.&lt;/div&gt;</summary>
		<author><name>Cristian</name></author>
	</entry>
</feed>