Code Monkey home page Code Monkey logo

Comments (10)

smv1999 avatar smv1999 commented on June 18, 2024 1

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.

from edualgo.

Abhijit2505 avatar Abhijit2505 commented on June 18, 2024 1
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.

from edualgo.

Prakhar-Mangal avatar Prakhar-Mangal commented on June 18, 2024

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

from edualgo.

Abhijit2505 avatar Abhijit2505 commented on June 18, 2024

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.

from edualgo.

Abhijit2505 avatar Abhijit2505 commented on June 18, 2024

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.

from edualgo.

pragatipal avatar pragatipal commented on June 18, 2024

from edualgo.

Priyaa-Agrawal avatar Priyaa-Agrawal commented on June 18, 2024

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

from edualgo.

pawankm21 avatar pawankm21 commented on June 18, 2024

Some icons are not visible

from edualgo.

Abhijit2505 avatar Abhijit2505 commented on June 18, 2024

Some icons are not visible

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

from edualgo.

Avdhesh-Varshney avatar Avdhesh-Varshney commented on June 18, 2024

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.

from edualgo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.