title: Problem about doubly linked list using arrays
body: <p><a href="https://i.stack.imgur.com/3bQ6L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3bQ6L.png" alt="enter image description here" /></a></p>
  <p>Hi we began talking about data structures and I'm having trouble coming up with a code for this problem
  This is basicaly a 3 arrays implementation of a doubly linked list , P(prev pointer)/N(next pointer)/D(data) but I'm having trouble understaing how I can use the new arrays outside of the fucntion?
  I mean from my understanding we are given an array and we are manipulating it but it just confuses me how the new arrays come into play..</p>
  <p>Also in the follow up questions, do they mean the complexity complexity or just each operation we need to perform like?
  btw it's my first time writing psedueocode, does it look okay?</p>
  <pre><code>InsertFirst(k)
  
  if (Free ≠ -1) then  
    q = free 
  else                         //Create new arrays
    newArray ➜ newD(2n)  
    newArray ➜ newP(2n) 
    newArray ➜ newN(2n)
  
   for i=0 ➜ n   
       newD[i] = D[i]   
       newP[i] = D[i]   
       newN[i] = D[i]
  
    newD[q] = k                //Insert first if list is full
    Free = newN[Free]  
    newN[q] = L  
    newP[L] = q  
    L = q  
    return
  
  D[q] = k                //Insert first if list is not full
  Free = N[Free] 
  N[q] = L 
  P[L] = q 
  L = q 
  return
  </code></pre>