Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug spotting #55

Open
Abhijit2505 opened this issue Nov 27, 2020 · 10 comments
Open

Bug spotting #55

Abhijit2505 opened this issue Nov 27, 2020 · 10 comments
Labels

Comments

@Abhijit2505
Copy link
Member

No software package can be free of bugs practically, we would like you to point out the bugs you see in the package and create an issue first describing the bug.

You can also point the bugs out as a reply to this issue.

@Abhijit2505 Abhijit2505 added Bug Spotting Spot the bug Easy enhancement New feature or request labels Nov 27, 2020
@Prakhar-Mangal
Copy link
Contributor

Some Bugs in Linear Search and Interpolation Search:

  1. In Linear Search If we find our searched elements then we need to break the loop, no further traversing required, same with Interpolation Search.
  2. In Interpolation search the condition is wrong while low <= high and array[low] <= array[high] it should be while low <= high and x >= array[low] and x <= array[high]:

@Abhijit2505
Copy link
Member Author

Some Bugs in Linear Search and Interpolation Search:

  1. In Linear Search If we find our searched elements then we need to break the loop, no further traversing required, same with Interpolation Search.
  2. In Interpolation search the condition is wrong while low <= high and array[low] <= array[high] it should be while low <= high and x >= array[low] and x <= array[high]:

Your reported bugs have been forwarded to the concerned team. Thanks for reporting.

@Abhijit2505
Copy link
Member Author

Some Bugs in Linear Search and Interpolation Search:

  1. In Linear Search If we find our searched elements then we need to break the loop, no further traversing required, same with Interpolation Search.
  2. In Interpolation search the condition is wrong while low <= high and array[low] <= array[high] it should be while low <= high and x >= array[low] and x <= array[high]:

@pragatipal, kindly solve this bug.

@pragatipal
Copy link
Member

pragatipal commented Nov 28, 2020 via email

@Priyaa-Agrawal
Copy link
Contributor

In line no. 448 of sort.py. return statement is missing in quick sort.

@smv1999
Copy link

smv1999 commented Jan 10, 2021

I have the following code:

from edualgo import algorithms as al
ping = al.search_algorithms()
arr = [10, 9, 4, 5, 7, 8]
ping.linear_search(arr, 5, True)

The script is saved as edualgo_try.py and I try to execute the script in Command Prompt as follows:

python edualgo_try.py > output.txt

As you can see, I am trying to save the output in a file called output.txt. But, I get an error which is as follows:

Traceback (most recent call last):
  File "edualgo_try.py", line 4, in <module>
    ping.linear_search(arr, 5, True)
  File "C:\Users\smv1999\AppData\Local\Programs\Python\Python36\lib\site-packages\edualgo\algorithms.py", line 1254, in linear_search
    self.linear_search_hint()
  File "C:\Users\smv1999\AppData\Local\Programs\Python\Python36\lib\site-packages\edualgo\algorithms.py", line 1297, in linear_search_hint
    print_msg_box(message)
  File "C:\Users\smv1999\AppData\Local\Programs\Python\Python36\lib\site-packages\edualgo\__init__.py", line 13, in print_msg_box
    print(box)
  File "C:\Users\smv1999\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 0-99: character maps to <undefined>

However if I remove the True parameter in the linear_search() method, I am getting the output saved in the file output.txt.
Linear Search Runtime = 0.0

Please have a look into this.

@Abhijit2505
Copy link
Member Author

from edualgo import algorithms as al
ping = al.search_algorithms()
arr = [10, 9, 4, 5, 7, 8]
ping.linear_search(arr, 5, True)

Hey @smv1999 ,
Thank you for reaching out regarding the bug, which is actually a feature we would like to implement in our future updates.

True is passed as a parameter for the console hint methods as that method contains few characters used in the formatting of the console output, those characters need to be encoded into UTF-8 in order to get printed into a text file.

Moreover, the hint methods are designed for the console purpose only and the similar text methods will be added in our next update where you don't have to explicitly add $ python code_file.py > output.txt,
But you can just use our text function (coming in next update), and pass your file name as a parameter in order to get the work done.
Thank you for reporting this feature and as you have demanded it, out next version will have the text methods as direct applications.

@pawankm21
Copy link
Contributor

pawankm21 commented Oct 2, 2021

Some icons are not visible

@Abhijit2505
Copy link
Member Author

Some icons are not visible

That's another repo, where the website work is present, please contribute to that one.

@Avdhesh-Varshney
Copy link

image

No output will be print on binary search when target element is present at the end of the array.
I would like to contribute to your repository under WOC'24. I have also submitted my proposal for the same.

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

No branches or pull requests

7 participants