When merely copying small snippets of code, it may be worth considering whether the use could be covered by a copyright exception, such as fair use in the US. Because if some exception applies you won't have to consider the licensing. You would still have to properly attribute the snippet, of course. Note also that while pseudocode is copyrightable, the underlying algorithm cannot be copyrighted.
If no exception applies, you would have to follow the license under which you acquired the snippet.
Wikipedia is generally dual-licensed under the GFDL and CC-BY-SA 3.0, though individual pages may differ (that should be noted on the page, though).
The GFDL can be understood as a historical artefact. Wikipedia originally used this license. However, the GFDL is highly incompatible with other licenses, and is geared towards books rather than websites. Compliance can be rather cumbersome. It is not compatible with any licenses that are used for source code.
A later version of the GFDL added a relicensing clause that made it possible for Wikipedia (but no one else) to relicense to CC-BY-SA 3.0. Wikipedia exercised that clause, and has been using dual-licensing with GFDL/CC-BY-SA 3.0 for roughly a decade now.
The CC-BY-SA 3.0 license has a much better compatibility story. In particular, you can choose to license adaptions a later license version, CC-BY-SA 4.0 allows you to use a compatible license, and Creative Commons has named the GPLv3 as a compatible license.
That means the full list of licenses that you can use code snippets from Wikipedia under include:
- GFDL (unversioned)
- CC-BY-SA 3.0 (explicit dual-license, and compatible licenses per GFDL 1.3 section 11)
- compatible licenses per section 4(b) (adaptations only!)
So an open source project really only has the option to copy code snippets from Wikipedia if the project uses GPLv3 or AGPLv3 licenses. Note this excludes many popular licenses such as MIT, LGPL, GPLv2, GPLv2+, GPLv3+, and so on.