Main thread
Hi,
Will this code be judged by time inefficiency?
I managed to write the code, but the DNA text of billions of chars is taking more then 1-2 mins.
Alon
Since we are dealing with running times in the scale of a few minutes, it may differ significantly from one computer to another. But I would not expect it to pass 10 minutes.
Please make sure you follow all the algorithmic instructions in the question, as this may have a major effect on time complexity.
אולי אני משתמש לא נכון, אבל כשאני מנסה להשתמש בפקודה שרשמתם לקריאת הקבצים הגדולים של ה-DNA, נראה שזה לוקח הרבה מאוד מאוד זמן (חיכיתי מספיק זמן לפני שביטלתי את ההרצה..). אני רושם ככה:
s1 = read_fasta("PF_C5.txt")
יש משהו שאני מפספס?
תודה!
הי,
אני מנסה להריץ את הקוד עבור סעיף ד אבל לצערי אני מקבל את השגיאה הבאה:
IDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection.
אני משתמש בווינדווס אקס פי עם אנטי וירוס נוד32 האם יש לכם רעיון כיצד לפתור את הבעיה? אין לי תוכנת פיירוול (אולי למעט הפיירוול של ווינדוז
תודה
You should try running the IDLE as Admin, if nothing works, I would download the .txt files and load them directly from your computer to test your code (yet, remember to submit it with the original function).
Some students encounter technical difficulties with reading the DNA files in Q5.
We suggest the following alternative:
Download the txt files to your local disk, and change read_fasta(filename) to:
def read_fasta(filename): f = open(filename) f.readline() #read the first line and discard it s = f.read() #read the rest of the file s = s.replace("\n","") #remove newline characters f.close() return s
In which format of read_fasta should we submit ? the web based previous version or in this version?
I assume the web based could crash at testing like it crashes sometimes for us…
Hello,
Are we allowed to use Class MyHashtable from the recitation log to implement our functions?
Are we allowed to use python builtin functions / solutions?
Yes and yes - you may use any python / recitation code as long as you follow the algorithmic details of the question.
האם אפשר להשתמש בשיטה רנדומית בסעיף א' וכך להסתכן בסיכוי קטן מאוד בטעות של הפונקציה או שהפונקציה חייבת להיות בטוחה?
yes, you may do that, if you are able to justify this complexity-wise.
hi,
when i do the binary search in this task i do 2 checks:
first i try to look if k2 != none and only then (if he is None) i cheack if mid != none, is it ok or we have to do only 1 cheack?
it take me 40 sec , do i need to change it?
hi,
In b, is it possible that there is not even one note that is common for the strings?
I mean k=0 is the longest?
Sure:
>>> longest_common_substring_range("abc", "123") (0, 1)
בסעיף א, כתוב שהפונקציה
common_substring
יכולה להחזיר תת מחרוזת משותפת כלשהי באורך הנתון, כלומר בקריאה
common_substring("introduction2cs", "function", 3)
מותר לפונקציה להחזיר אחת מהאפשרויות
"cti" , "tio" , "ion"
אך בקוד יש בדיקה שלפיה הערך המוחזר חייב להיות
"cti"
ולא אף אחת מהאפשרויות האחרות. זה טוב אם הקוד שלי מחזיר
"tio"
במקום? (לפי ניסוח השאלה הבנתי שהוא אמור להתקבל)
ושאלה אחרת: האם מותר לכתוב פונקציות עזר שלא היו כתובות בשאלה?
You are right - this test is not valid.
We will accept any common substring of the specified length.
In the binary search of this question, Will it be accepted to do a ternary search, instead?
Only if it takes less time than binary search.