homework

Generalization functions for Q-Learning

I have to do some work with Q Learning, about a guy that has to move furniture around a house (it's basically that). If the house is small enough, I can just have a matrix that represents actions/rewards, but as the house size grows bigger that will not be enough. So I have to use some kind of generalization function for it, instead. My ...

Simple Javascript MYSQL checking function

Hi friends, I'm not very skilled in web developing by the moment but i've managed to create a web application with PHP that queries a MYSQL Database and shows data in HTML. I would like to check if the table has changed using a timestamp field that I already created and that updates on every insertion. Comparing two timestamps (the pre...

C++ run time error with protected members

I am trying to do a homework assignment where we insert a string into a string at a specified point using a linked stack, hence the struct and typedef. Anyway, when I try to access stringLength in the StringModifier class inside the InsertAfter method, I get a run time error and I cannot figure out what the problem is. I should be able t...

An exam question about reliable protocol.

Consider the following file transport application, which uses the protocol defined below to reliably service a client’s request. The protocol has the following characteristics: • The protocol runs across a network with a 1050 byte MTU, a 20 ms one-way latency. • Each transferred packet consists of a total of 50 bytes of packet header...

big O homework question

I need to state the big o of the following fragment: sum =0; for (int i=1; i<n; i++) { for (int j=1; j< n/i; j++) { sum = sum +j; } } I know the outer loop is O(n) but I am having a problem analyzing the inner loop. I think it's O(log n). I would appreciate any help. Thank you in advance. ...

SQL query for the given table

I have 2 tables, Student and Supervisor: STUDENT(supervisorid(pk),name,email....) SUPERVISOR(supervisorid(pk),name,email....) Now I need to print supervisor name, email and the # of students under the supervisor (they will have same supervisor id). Something like: select supervisorname, supervisoremail, tot_stud as (s...

What does this notation mean in C?

int *w; int **d; d = &w; What does the **d store exactly? ...

How can I indent cout output?

I'm trying to print binary tree void print_tree(Node * root,int level ) { if (root!=NULL) { cout<< root->value << endl; } //... } How can I indent output in order to indent each value with level '-' chars. ...

Supervisor / Administrator Mode

What are the assembly commands that can be executed only with administrator or supervisor authorization? (kernel 00) ...

How to check for division by 7 for big number in C++?

I have to check, if given number is divisible by 7, which is usualy done just by doing something like n % 7 == 0, but the problem is, that given number can have up to 100000000, which doesn't fit even in long long. Another constrain is, that I have only few kilobytes of memory available, so I can't use an array. I'm expecting the numbe...

appending h2 to image with jquery

hi im trying to add a h2 with the title of an image after each image in my page... this is what ive got so far... not really sure where im goin wrong $("img[title]").each(function(){ this.after("<h2>" . this.attr(title) "</h2>"); }); ...

Local Chat server in C using IPC

Hi Guys I need to write a chat server in C. It only needs to use IPC. Could you help me on how to proceed on this. A skeleton code will help me a lot. ...

strncmp C Exercise

I'm trying to do exercise 5-4 in the K&R C book. I have written the methods for strncpy and strncat, but I'm having some trouble understanding exactly what to return for the strncmp part of the exercise. The definition of strncmp (from Appendix B in K&R book) is: compare at most n characters of string s to string t; return <0 if s...

Binary Tree Isomorphism

I have an assignment to write among other things, a set of prolog predicates that determine if any two binary tree's are isomorphic to each other. The predicate must also be able to provide all of the isomorphic graphs to any given binary tree. Here is what I have so far, it works except for returning duplicates. % Clause: btree_iso ...

HW Help: Java programming

Ok. This is my HW and I am kind of lost. I appreciate if you can help me: Credit card companies use built-in "checksums" as added security measures when creating the account numbers on credit cards. This means that there are only certain valid credit card numbers, and validity can instantly be detected by using an algorithm that may inv...

Question About VC Dimension

If I have the input space of (1,2,....999). And I have a concept class C, with 10 concepts: C0,C1,C2...C9. Given an input, that input is an element of ci if the it contains the digit i. For example, the number 123 is an element of c1 and c2 and c3. What is the VC Dimension of this concept class C? ...

Appending an integer to a List in Ocaml

How can i implement this function? let rec append l i = (* For example, if l is a list [1;2] and i is an integer 3 append [1;2] 3 = [1;2;3]*) ;; ...

visual c++: convert int into string pointer

how to convert integer into string pointer in visual c++? ...

tail recursion sum, power, gcd in prolog?

hi guys, how can I accomplish this: Give a tail-recursive definition for each of the following predicates. power(X,Y,Z): XY=Z. gcd(X,Y,Z): The greatest common divisor of X and Y is Z. sum(L,Sum): Sum is the sum of the elements in L. so far I have done this but not sure if that's correct power(_,0,1) :- !. power(X,Y,Z) :- Y1 is Y -...

how to read digits from text file and save it in an array "using MATLAB or JAVA" ?

hi, I have similar problem with little changes, which is: I have text file contain large number of lines with different sizes "i.e. not all lines has same length" each line contain integers only. as an example A.txt = 4 6 4 1 2 2 5 7 7 0 9 5 5 3 2 43 3 32 9 0 1 3 1 3 4 5 6 7 4 34 5 8 9 0 7 6 2 4 5 6 6 7 5 4 3 2 21 4 9 8 4 2 1 ...