Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Added logarithmic Exponentiation Implementation #62

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

prachiagrawal269
Copy link

@aktech Please review
references #12

@prachiagrawal269 prachiagrawal269 force-pushed the logarithmic-exponentiation branch 2 times, most recently from 29e4303 to 1f4519d Compare April 10, 2016 07:45
@CuriousLearner
Copy link
Member

Hi @prachiagrawal269 Travis CI's test failed, please correct the issues.

@prachiagrawal269
Copy link
Author

@aktech @CuriousLearner The build for this pull request is failing for higher versions of python (3.2 and above).
I am unable to understand the problem with the build. Can you please look into it once.
Thanks

@@ -9,3 +9,4 @@
from .binary_search import binary_search
from .linear_search import linear_search
from .queue import queue
from .logarithmic_exponentiation import logarithmic_exponentiation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a newline here

@malayaleecoder
Copy link
Contributor

@CuriousLearner @aktech If we are integrating this, I think logarithmic_exponentiation is pretty long to type and should be made short ?!
@prachiagrawal269 : Not sure whether this the problem, in the test you have given random integers from 1 to 100, I think if it is something like 100^100 it would take a long time. Try reducing the domain ?!

@prachiagrawal269
Copy link
Author

@malayaleecoder number 100 in binary can be represented as 1100100 i.e. it requires just 7 bits for its representation. Hence logarithmic exponentiation would just require just 7 iterations to compute 100^100. So I don't think its a domain issue that is taking long time.

@malayaleecoder
Copy link
Contributor

@prachiagrawal269 Actually I was referring to the a**b part in the test. Thought for a moment that I was in the C world. My bad :P

result = result*base

base = base*base
exponent = exponent/2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using // operator would perform integer division, which is the required behavior.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @goelakash
The error got fixed.

@goelakash
Copy link
Collaborator

@prachiagrawal269 Please resolve the conflicts.

@prachiagrawal269
Copy link
Author

Merge conflicts removed.
Please review

@goelakash
Copy link
Collaborator

@prachiagrawal269 Please squash the commits.

Added logarithmic Exponentiation Implementation

reduced the domain for tests

operator modified for integer division

merge conflicts removed
@CuriousLearner
Copy link
Member

@aktech @goelakash @leosartaj

See if it's good to go now.

@prachiagrawal269 Once you do changes, remember to ping someone so that your PR could be reviewed.

from .stack import Stack
from .radix_sort import radix_sort
from .stack import Stack
from.radix_sort import radix_sort
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a space between from and .radix_sort

@goelakash
Copy link
Collaborator

goelakash commented Jul 26, 2016

@CuriousLearner The commits aren't squashed yet. @prachiagrawal269 Here's a guide to squashing git commits - http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants