Push-down automaton for a language with number of 1s double than 0s This questions is taken from a complexity theory course.


  Design a push-down automaton that recognize $L = x \in \{0,1\}^* $
  such that $x$ contains a number of ones double than a number of zeros.


Example: x = 011011, 100011111, 011011110.

My approach

I tried to push on the stack a symbol "A" every time I read "0", than pop "A" from the stack when I read two consecutive "1" but this approach works not for every string $x$ in the language. Maybe the final PDA is non-deterministic. Any hints?
Consider this algorithm:


Initialize a variable $x := 0$.
Scan the string, left to right. If you see $1$, set $x := x + 1$, if you see $0$, set $x := x - 2$.
When you are done, accept iff $x = 0$.


It should be obvious that it recognizes your language. Can you figure out a way to implement it replacing the counter with the stack?