DSC-IIITL / GitGrind

9 stars 58 forks source link

Provided alternate solution for power by using a recursive approach #25 #48

Closed beforeIkillYou closed 9 months ago

beforeIkillYou commented 9 months ago

Hey @shishiro26 @Illuminati9 @Kota-Karthik @akhilender-bongirwar , solved issue #25 . Provides an alternate approach to the power function by converting its implementation to recursive #25

beforeIkillYou commented 9 months ago

Hey @shishiro26 @akhilender-bongirwar @Illuminati9 @Kota-Karthik the approach i went for solving this issue is pretty straightforward. Instead of finding the power iteratively i went for a recursive approach which uses basic recursion for raising the base to a specified power.

Screenshot 2023-10-19 175204

This above written function by me is the direct implementation of recursive exponentiation algorithm and this image gives a pretty clear view of how it works-

Screenshot 2023-10-19 175629

beforeIkillYou commented 9 months ago

Hey @akhilender-bongirwar @Illuminati9 @PavanaSakethaRam , removed all the commented code from issue #25 and provided a solution using a recursive approach.

beforeIkillYou commented 9 months ago

Hello @akhilender-bongirwar @Illuminati9 @shishiro26 @Kota-Karthik , i completed all the required changes . Made the required folders and commented all the unnecessary code and and text.

beforeIkillYou commented 9 months ago

Hello @akhilender-bongirwar @Illuminati9 @shishiro26 @Kota-Karthik , i completed all the required changes . Removed the 'power.cpp' file.