homework

Attempting to convert an if statement to assembly

What am I doing wrong? This is the assmebly I've written: char encode(char plain){ __asm{ mov al, plain ;check for y or z status cmp al, 'y' je YorZ cmp al, 'z' je YorZ cmp al, 'Y' je YorZ cmp al, 'Z' je YorZ ;check to make sure it is in the alphabet now mov cl, al sub cl, 'A' ...

Proving that a function f(n) belongs to a Big-Theta(g(n))

Its a exercise that ask to indicate the class Big-Theta(g(n)) the functions belongs to and to prove the assertion. In this case f(n) = (n^2+1)^10 By definition f(n) E Big-Theta(g(n)) <=> c1*g(n) < f(n) < c2*g(n), where c1 and c2 are two constants. I know that for this specific f(n) the Big-Theta is g(n^20) but I don't know who to prov...

What is difference between a job and a process in Unix ?

What is the difference between a job and a process in Unix ? Can you please give an example ? ...

Optimizing comparison instruction count (PDP-11)

For PDP-11, how can I change the following snippet of assembly so that it's only two instructions, yet does the same work as these four? tst r0 blt label cmp r0, #75 bgt label ...

populating each character to std::vector <char *> from console application.

Hi, I am trying to write a C++ Console based application which collects and populates each characters typed in the console to a std::vector <char *> asynchronously without blocking the user Can anyone help me in how to populate each char entered in std::vector <char *> . John ...

Printf in assembler doesn't print

Hi there, I have got a homework to hack program using buffer overflow ( with disassambling, program was written in C++, I haven't got the source code ). I have already managed it but I have a problem. I have to print some message on the screen, so I found out address of printf function, pushed address of "HACKED" and address of "%s" on t...

using 'new' operator

I have simple task concerning 'new' operator. I need to create array of 10 chars and then input those chars using 'cin'. Should it look like this ? : char c = new char[10]; for(int i=0; i < 10; i++) { cin >> char[i] >> endl; } ...

How to get Current Owner name ?

Hi My question is i have 4 Text Box 1) Prepared By 2) Checked By 3) Approved BY 4) Created BY First i will login as Smitha then in " Preapred by " - Smitha name should come automatically n all other text box should be blank, then i will submit the form it goes to our respective HOD now , Nagaraj sir will login as Nagaraj.S then i...

seperating interface and implemention with normal functions

this seems like it should be pretty simple, im probably leaving something simple out. this is the code im trying to run. it is 3 files, 2*cpp and 1*header. this wont run on code blocks, im trying to see what im missing! these are the errors given: obj\Debug\main.o||In function `main':| |9|undefined reference to `generateArray(int*, ...

templates of functions

I'm told to create template of function , that will take 4 arguments : pointer reference pointer to array pointer to function How to perform this task ? I was trying : #include <iostream> using namespace std; int nothing(int a) { return a; } template<typename T> T func(int *L, int &M, char *K, int (*P)(int)) { cout << L <<...

Which web Tier Framework for a public commercial website with heavy load ?

Hello everyone, As a part of an enterprise architecture exercise, i need to find a java-based framework filling these constraints : heavy (i think) load : 5000 concurrent connections widely known : can't be too exotic, the contractors would be too high priced. relatively easy to use : developpement time must be reasonnable must be as ...

Help understanding Reverse Polish Notation for homework assignment?

I have been asked to write a simple Reverse Polish Notation calculator in C as part of a homework assignment. I'm having difficulty understanding RPN. Can you please help me understand Reverse Polish Notation? Also, any tips on how to approach this problem would be greatly appreciated. ...

Understanding prolog [lists]

I am to write a program that does this: ?- pLeap(2,5,X,Y). X = 2, Y = 3 ; X = 3, Y = 4 ; X = 4, Y = 5 ; X = 5, Y = 5 ; false. (gives all pairs X,X+1 between 2 and 5, plus the special case at the end). This is supposedly the solution. I don't really understand how it works, could anyone guide me through it? pLeap(X,X,X,X). pLeap(L,H,...

dynamic programming: speeding up this function

i have this program //h is our N static int g=0; int fun(int h){ if(h<=0){ g++; return g; } return g+fun(h-1)+fun(h-4); } is it possible to speed it up using dynamic programming i fugured out this function runs in O(2^n) it means that i suppose to redu...

what is value of x for load and store

This is some challenge On a single processor system, in which load and store are assumed to be atomic, what are all the possible values for x after both threads have completed in the following execution, assuming that x is initialised to O? Hint: you need to consider how this code might be compiled into machine language. for (int i = 0...

Regular expression for strings with an even number of zeroes and ones

What is a regular expression for strings of 0 and 1 with an even number of zeros and an even number of ones? I have something like (1*01*01*)*(0*10*10*)*. Does it look good? ...

Binary Addition. Is it overflow?

Binary values are in 2s Complement form. If I am to add 110001 (-15) and 101110 (-18), and the answer has to be stored in a 6-bit integer, is this an underflow/overflow. ...

Return a number between 0 and 4

How do I return a number between 0 and 4, depending the input number? For example if I pass it number 23 it will return 3. The number set should look like 0 5 10 15 20 .. 1 6 11 16 21 .. 2 7 12 17 22 .. 3 8 13 18 23 .. 4 9 14 19 24 What's the math for this? ...

Double Linked List Insertion Sorting Bug

Hello, I have implemented an insertion sort in a double link list (highest to lowest) from a file of 10,000 ints, and output to file in reverse order. To my knowledge I have implemented such a program, however I noticed in the ouput file, a single number is out of place. Every other number is in correct order. The number out of pla...

Parse a CSV file using python (to make a decision tree later)

First off, full disclosure: This is going towards a uni assignment, so I don't want to receive code. :). I'm more looking for approaches; I'm very new to python, having read a book but not yet written any code. The entire task is to import the contents of a CSV file, create a decision tree from the contents of the CSV file (using the ...