Your immediate response will be greatly appreciated
Thanks to avoid such comment if you answer 24hrs after a reply posted within 30min after your question...
What algo do you need? The installation of extensions or the creation of such an extension? Source code should be available somewhere on the Apache Software Foundation site but you'll get the whole code I guess.
Creation of extensions is documented in the extension site. There is also an extension to build extensions (Basic Addon Builder IIRC).
AOO 4.1.3 on Xubuntu 17.04, (Zesty Zapus) and on Windows 7 (with winPenPack port).