eduAlgo icon indicating copy to clipboard operation
eduAlgo copied to clipboard

Bug spotting

Open Abhijit2505 opened this issue 3 years ago • 10 comments

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 avatar Nov 27 '20 01:11 Abhijit2505

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]:

Prakhar-Mangal avatar Nov 28 '20 05:11 Prakhar-Mangal

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 avatar Nov 28 '20 06:11 Abhijit2505

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.

Abhijit2505 avatar Nov 28 '20 06:11 Abhijit2505

Okay I'd fix it

On Sat, 28 Nov 2020, 11:50 Abhijit Tripathy, [email protected] wrote:

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 https://github.com/pragatipal, kindly solve this bug.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Abhijit2505/eduAlgo/issues/55#issuecomment-735045967, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQ6RDDJO2RFYUMBJZ2HG2OLSSCJCDANCNFSM4UEKYTWA .

pragatipal avatar Nov 28 '20 09:11 pragatipal

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

Priyaa-Agrawal avatar Dec 15 '20 19:12 Priyaa-Agrawal

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.

smv1999 avatar Jan 10 '21 10:01 smv1999

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.

Abhijit2505 avatar Jan 15 '21 14:01 Abhijit2505

Some icons are not visible

pawankm21 avatar Oct 02 '21 12:10 pawankm21

Some icons are not visible

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

Abhijit2505 avatar Oct 04 '21 05:10 Abhijit2505

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.

Avdhesh-Varshney avatar Feb 23 '24 14:02 Avdhesh-Varshney