public LLElement()
			{
				IntervalBegin = this;
				IntervalEnd = this;
				IntervalSize = 1;

#if LinkedListDebug
				DebugId = ++DebugIdGen;
#endif
			}
			/// <summary>Inits the linked list of structures by allocating an array, and filling this array with the structures linked in ascending order.</summary>
			/// <param name="count">Number of structures.</param>
			public void Init(int count)
			{
				L = new LLElement[count];
				for (int i = 0; i < count; ++i)
				{
					L[i] = new LLElement() { Next = i + 1, Previous = i - 1, IntervalBegin = i, IntervalEnd = i, IntervalSize = 1, Idx = 0, Lcp = 0 };
				}
				L[0].Previous = -1;
				L[count - 1].Next = -1;
				First = 0;
				Last = count - 1;
			}
		private void create_interval(LLElement end, LLElement begin, int lcp, int size)
		{
			begin.IntervalBegin = begin;
			begin.IntervalEnd = end;

			end.Lcp = lcp;
			end.IntervalBegin = begin;
			end.IntervalEnd = end;
			end.IntervalSize = size;
		}
		/// <summary>Initializes all intermediates arrays and objects.</summary>
		private void InitializeIntermediates()
		{
			// initialize items
			_items = new LLElement[_numberOfWords][];
			_ddlList = new LinkedList();
			for (int i = 0; i < _items.Length; ++i)
			{
				_items[i] = new LLElement[_x_repeats];
				for (int j = 0; j < _x_repeats; ++j)
				{
					LLElement ele;
					_items[i][j] = ele = new LLElement();
					ele.IntervalSize = 0;
					_ddlList.AddLast(ele);
				}
				_items[i][0].IntervalSize = 1;
			}

			// initialize intermediates
			_last_index = new int[_numberOfWords];
			_pqls = new MinimumOnSlidingWindow[_numberOfWords];
			for (int i = 0; i < _numberOfWords; ++i)
			{
				_pqls[i].Initialize(_x_repeats, 0);
			}

			_lastLcp = new LLElement[_maximumLcp + 1];

			var begin = _ddlList.Last.Previous; // front.prev->prev;
			LLElement end = _ddlList.First; // originally back.next
			begin.IntervalEnd = end;
			end.IntervalBegin = begin;
			if (_x_repeats > 1)
			{
				end.IntervalSize = _numberOfWords;
			}
			else
			{
				end.IntervalSize = _numberOfWords - 1;
			}
			_ddlList.Last.IntervalEnd = _ddlList.First;
			_ddlList.First.IntervalBegin = _ddlList.Last;
			_ddlList.First.IntervalSize = _numberOfWords;
			_lastLcp[0] = _ddlList.First;
		}
			public LLElement(int lcp, int idx)
			{
				Lcp = lcp;
				Idx = idx;
				IntervalBegin = this;
				IntervalEnd = this;
				IntervalSize = 1;
#if LinkedListDebug
				DebugId = ++DebugIdGen;
#endif
			}
			public void Remove(LLElement node)
			{
				var prev = node.Previous;
				var next = node.Next;

				if (null != prev)
					prev.Next = next;
				else
					_first = (LLElement)next;

				if (null != next)
					next.Previous = prev;
				else
					_last = (LLElement)prev;

				--_count;
			}
			public void AddLast(LLElement node)
			{
				if (null == _last)
				{
					_last = node;
					_first = node;
					node.Next = null;
					node.Previous = null;
				}
				else
				{
					node.Next = null;
					node.Previous = _last;
					_last.Next = node;
					_last = node;
				}
				++_count;
			}
		/// <summary>Initialize all intermediate arrays and objects.</summary>
		private void InitializeIntermediates()
		{
			// initialize intermediates
			_lastLcp = new LLElement[_maximumLcp + 1];
			_ddlList = new LinkedList();
			_textPtr = new LLElement[_numberOfWords];
			for (int i = 0; i < _numberOfWords; ++i)
			{
				var ele = new LLElement();
				_ddlList.AddLast(ele);
				_textPtr[i] = ele;
			}
		}