RC4 , Is it possible to find the key if we know the plaintext and ciphertext? Is it possible to find the key if we know the plaintext and ciphertext with RC4. How should I write the algorithm?
No, to the best of our knowledge, it is not possible, apart from a brute force search over all possible keys.  RC4 has known cryptographical weaknesses; however, none of them are of much help in recovering the key, given a plaintext/ciphertext pair.

There are backtracking approaches that might take circa $2^{700}$ effort independent of the key size; however that is impractically huge (and unless the key is huge, a brute force search is still simpler)

On the other hand, if you have two ciphertexts encrypted with the same RC4 key, and you know the plaintext for one of the ciphertexts, it's easy to recover the other plaintext.  All you need to do is compute the exclusive-or of the two ciphertexts, and the known plaintext -- the result will be the unknown plaintext.

This works because RC4 takes the key, and using that, generates a long string of bytes (the keystream).  RC4 then takes the keystream, and exclusive-or's that with the plaintext, generating the ciphertext.  That is, if $P_i$ is byte $i$ of the plaintext, and $C_i$ is byte $i$ of the ciphertext, and $RC4_i(key)$ is byte $i$ of the keystream generated by the key, then:

$$C_i = P_i \oplus RC4_i(key)$$

If we have a second plaintext $P'$ and ciphertext $C'$ that is encrypted with the same key, we then have:

$$C'_i = P'_i \oplus RC4_i(key)$$

Combining them, we have:

$$P_i = P'_i \oplus C_i \oplus C'_i$$

Now, we can recover the values of $RC4_i(key)$, however there's no known way to recover $key$ from that.  However, if all you want to know is the plaintext $P$, you don't need the key.

Of course, if $P$ (the unknown plaintext) is longer than $P'$ (the known plaintext), this trick will reveal only the first part of $P$.

In addition, even if you don't know the value of $P'$, a similar trick will allow you to compute be value of $P \oplus P'$ - depending on what the plaintext is, that is often sufficient to allow an attacker to deduce the original values of $P, P'$.  Hence, it is always a mistake to RC4 encrypt two different things with the exact same key.