Recent content by r0bHadz

  1. R

    Comp Sci Not sure how this swi-Prolog problem is suppose to be answered

    From what I know, we can write a fact, such as mother('Ivana Trump', 'Ivanka Trump'). But I am lost. Is there suppose to be some convention, which states which one comes first? Does the mother or the child come first? Basically, I have no clue what the answer to this question is suppose to...
  2. R

    Comp Sci Declaring arrays statically, on the stack and heap

    that's the only difference between declaring static and declaring on a stack? edit: finally found the slide that is suppose to teach me this stuff. I guess I over looked it. You can ignore the above question, I'll be back if I have anymore though.
  3. R

    Comp Sci Declaring arrays statically, on the stack and heap

    I'm confused here. I guess my professor mean "statically" in the problem, but anyways, I thought, in C++, that declaring an array statically is the as declaring the array on the stack? For example, if I have a function: void staticArr(){ int a[10000]; } here I am declaring an array...
  4. R

    Comp Sci Finite state machine that doesn't terminate and detects overlapping strings

    Sounds intense Tom! Cool to see that this stuff is used in the real world.
  5. R

    Comp Sci Finite state machine that doesn't terminate and detects overlapping strings

    You are a legend Tom. I was just going through it but I don't think I would have caught that. Good eye, man. I appreciate ya! edit: I'm not sure what you mean exactly if the first character is C. If you mean the input string starts with a c, then it goes from state q_0 to state q_4 Also, if...
  6. R

    Comp Sci Finite state machine that doesn't terminate and detects overlapping strings

    Attached is what I have so far. I believe it is done but I am not 100% sure. It seems to me like every case is considered. For each state, and output of a,b, or c is possible.
  7. R

    Why is the number of lines in my bash output showing as 4 instead of 3?

    hmm wrong forum maybe this should go to programming and computer science instead? Can I get a mod to help me out edit: actually please delete this thread I have my answer now :) thank you
  8. R

    Why is the number of lines in my bash output showing as 4 instead of 3?

    In bash, I am writing the following: ps - ly this command gives me output of three lines then I do: ps -ly | wc -l to read the number of lines. It says 4. I clearly see that there are three lines. Thinking that there might be a new line possibly, I open export the command output to a file...
  9. R

    Need help understanding what an ADT (abstract data type) is exactly

    I've read quantum quests data structures bible but I'm still confused. I need help in simplest terms understanding what an ADT actually is and how it's different from a data structure. So a data structure is a way of organizing data. I can understand why a stack, or a queue would fall under...
  10. R

    I don't understand my prof's notes relating to time complexity

    and your suspicion was correct! I appreciate the reply :)
  11. R

    Algorithm analysis problem turned into a math problem

    That is one amazing resource man. I am only able to skim through it right now but I can already tell I'm going to be coming back to that a LOT! Much love for that man
  12. R

    I don't understand my prof's notes relating to time complexity

    Problem Statement: I've attached a picture of his notes. For a sorted array, to update it he put: O(logn)+O(1) Relevant Equations: O(n) + O(logn) = O(n) I don't see how it can be O(logn)+O(1) and not O(logn)+O(n) in the worst case After you find the index that needs updating, and you...
  13. R

    Algorithm analysis problem turned into a math problem

    The equation listed is the implicit form. I achieved this a weird way. \begin{array}{|c|c|c|} \hline 1 & 1 & 1*1 \\ \hline 2 & 6 & 2*3 \\ \hline 3 & 18 & 3*6 \\ \hline 4 & 40 & 4*10 \\ \hline 5 & 75 & 5 * 15 \\ \hline 6 & 126 & 6 * 21\\ \end{array} Focusing on the third column now, I can...
  14. R

    Comparing sorting algorithms -- Insertion Sort vs. Merge Sort

    The answer says insertion sort runs faster when we're sorting less than 43 items. I agree but with the condition that the first item will not be faster. Why does the answer not mention this? Is it because it is insignificantly faster?
  15. R

    Can anyone explain the following distribution to me?

    Apparently the initial distribution for this problem, P_0 = ( 0 0 1 0 0 0 0 0 ) but I do not understand why there are 8 entries?
Back
Top