The first pic is classic. The p trap is on backwards, and those corrugated lines should be outlawed. Looks like the popup drain is a bit too close to the wall, which may require a 1/8 or 1/16 bend to accommodate the properly installed p trap. The second pic shows an s-trap. You don't want that. Either remove the shelf & extend the tailpiece, or cut a slot in the shelf to accommodate the trap.