title: How to shift the data in a list
body: <p>I have the following case and I want to get a general solution without heavy looping and slicing .</p>
  
  <p>Firstly : </p>
  
  <p>I initialize <code>N</code> which through it I calculate the list size (initial size) :</p>
  
  <p>Through this Equation <code>N(N-1)/2</code>..</p>
  
  <p>let's say I set <code>N = 5</code> so  the initial size will be <code>10</code> .</p>
  
  <p>After that I fill the list with one's and zeroes with some method .</p>
  
  <p>Like this :</p>
  
  <blockquote>
    <p>0 1 0 1 1 1 0 1 0 1</p>
  </blockquote>
  
  <p>This list segmented according to N where the segments are (N-1).</p>
  
  <p>So </p>
  
  <ul>
  <li>The First Segment is : <code>0 1 0 1</code></li>
  <li>The Second Segment is : <code>1 1 0</code></li>
  <li>The Third Segment is : <code>1 0</code></li>
  <li>and The Forth Segment is : <code>1</code></li>
  </ul>
  
  <blockquote>
    <p>[0 1 0 1] [1 1 0] [1 0] [1]</p>
  </blockquote>
  
  <p>What I wanna to do is if I enter any number as input N again:</p>
  
  <p>Maintain the previous data with the proper shifting</p>
  
  <p>According to the new size .for example if N=6 so  the size will be 15 </p>
  
  <p>So I will have 5 segments in stead of 4</p>
  
  <p>I want it like this :</p>
  
  <blockquote>
    <p>[0 1 0 1 <strong>0</strong>] [1 1 0 <strong>0</strong>] [1 0 <strong>0</strong>] [1 <strong>0</strong>] [<strong>0</strong>]</p>
  </blockquote>
  
  <p>And vice verse If i enter N = 7 firstly and fill it .then i enter N = 4</p>
  
  <p>I wanna to make the proper shifting </p>