I try to explain it, that no coding is required :-) Taking more of a process view...
Assembly and sending of a tx:
the wallet software of A looks up it's internal database, if there is a transaction with required amount of 1 BTC on it. If yes, it then looks up this transaction's details in the blockchain, and finds in this transaction the pk script (spending condition), and assembles a new transaction, which shall move the funds to B's address. The wallet software then signs a hash of this transaction. The signature of this hash and the public key are placed in the [scriptsig] field of the transaction. So the final transaction contains the previous tx hash, signature and pubkey, and also an output section, with a pub key script (for B's target address) and the amount. That's what the picture shows.
The transaction is then sent to the network.
Transaction Verification:
In the network are verifying nodes, that check for validity of the tx. Amongst others, these nodes check that you have the right to spend the funds. They take the current tx' sigscript (<signature>
and <public key>
), and from the previous tx the output script (pubkey script). Then basically two comparisons take place:
1.) can the public key of the previous tx' sigscript be hashed to the same value as the presented hash in the current tx' pubkey script?
2.) is the signature a valid signature for the public key
With the first check, it is assured, that the current transaction moves the funds to the previously defined target address. And with the second check it is verified, if the signature aligns to the presented public key.
For the second test: the wallet software creates a signature, which requires the private key of the owner of the public address. The private key is used to sign the hash of the current transaction.
The picture you provided has a presentation of the parts to create the spending tx. Not the verifying part. That makes it a bit more complex to derive functionality... I had a very good reading with Ken Shirrif's article here:
http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html
and also (of course) Andreas' book "Mastering Bitcoin" (Second Edition), which is also online available.