Comments (10)
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.
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.
Some Bugs in Linear Search and Interpolation Search:
- In Linear Search If we find our searched elements then we need to break the loop, no further traversing required, same with Interpolation Search.
- In Interpolation search the condition is wrong
while low <= high and array[low] <= array[high]
it should bewhile low <= high and x >= array[low] and x <= array[high]:
from edualgo.
Some Bugs in Linear Search and Interpolation Search:
- In Linear Search If we find our searched elements then we need to break the loop, no further traversing required, same with Interpolation Search.
- In Interpolation search the condition is wrong
while low <= high and array[low] <= array[high]
it should bewhile 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.
Some Bugs in Linear Search and Interpolation Search:
- In Linear Search If we find our searched elements then we need to break the loop, no further traversing required, same with Interpolation Search.
- In Interpolation search the condition is wrong
while low <= high and array[low] <= array[high]
it should bewhile low <= high and x >= array[low] and x <= array[high]:
@pragatipal, kindly solve this bug.
from edualgo.
from edualgo.
In line no. 448 of sort.py. return statement is missing in quick sort.
from edualgo.
from edualgo.
That's another repo, where the website work is present, please contribute to that one.
from edualgo.
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)
- Heap Class Addition HOT 1
- StairCase Search in Row and Column sorted matrix HOT 5
- Quick Sort using Median of Medians Algorithm HOT 2
- Hint is missing in Fibonacci Series HOT 4
- __init__ file is empty HOT 3
- eduAlgo logo not displaying in About Us section HOT 2
- [Feature] Circular Singly Linked List HOT 1
- Add Tim Sort for Efficient Sorting HOT 2
- Add Moore Voting Algorithm HOT 1
- Pattern Searching::Mismatch Observation - Implement KMP Algorithm HOT 3
- Plagiarism Detection :: Patten Matching by hashing - Rabin Karp Algorithm HOT 4
- Shortest Path :: Optimization for Negative Weighted Edges : Johnson's Algorithm(Subroutine)
- (PTC-W0068) Consider using identity comparison with singleton HOT 2
- (PYL-W0102) Dangerous default argument HOT 3
- openCV basic operations HOT 2
- Delete linked list node HOT 2
- Add Radix Sort for Sorting HOT 2
- Stack sequence finder HOT 3
- Comparison to singleton `True` should be `expr is True`
- Consider using `mapp.items()` to iterate over the dictionary HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from edualgo.