homework

Clique problem algorithm design

One of the assignments in my algorithms class is to design an exhaustive search algorithm to solve the clique problem. That is, given a graph of size n, the algorithm is supposed to determine if there is a complete sub-graph of size k. I think I've gotten the answer, but I can't help but think it could be improved. Here's what I have:...

How do the web analytics tools work?

I am in process of gathering information about web analytics tools (like google web analytics) for my next assignment, but I am not able to find any good information. I am looking for: 1. Key terms used 2. What all mediums are available for data collection and How they works. 3. Any reference books, white papers etc (technical and non...

Add or Sum of hours like 13:30+00:00:20=13:30:20 but how?

Hello coders!!! i want to add second(00:00:02) or minutes (00:00:20) on datetime value (may be stored string type) but how? Examples: 13:30+02:02:02= 15:32:02 , 13:30+00:00:01= 13:30:01 , 13:30+00:01:00=13:31:00 or 13:30(not important) how can you help me? I need your cool algoritm :) thanks again... ...

Python: loop over consecutive characters?

In Python (specifically Python 3.0 but I don't think it matters), how do I easily write a loop over a sequence of characters having consecutive character codes? I want to do something like this pseudocode: for Ch from 'a' to 'z' inclusive: # f(Ch) Example: how about a nice "pythonic" version of the following? def Pangram(Str): ...

Java socket programming

Leading on from my previous questions I am going to try and clarify one of the problems I am facing. I am trying to create a multiplayer version of PacMan. A simple overview of how i've made my application is that I have a server which has a ServerSocket which is constantly listening on a specific port. Once a client connects it creat...

Linux & C: How to set file reading priority in multi-process program?

This is for an assignment I'm working on, and NO I'm not looking for you to just GIVE me the answer. I just need someone to point me in the right direction, maybe with a line or two of sample code. I need to figure out how to set the priority of a file read operation from within my program. To the point: server process receives a mess...

Programming Using Alice

I am currently studying and my next subject is 'Programming Using Alice'. Has anyone had any experience using this? And how would you rate it as a learning tool? ...

Finding closest number in an array

in an array first we have to find whether a desired number exists in that or not? if, not then how will i find nearer number to the given desired number in java. ...

Build OnetwoThree linked list with minimum assignment operators

I came across this problem while preparing for an interview and curious to know the diffrent ways it can be written. I found this at http://cslibrary.stanford.edu/103/ and have given the problem as it is. here is a code to build the list {1,2,3} struct node* BuildOneTwoThree() { struct node* head = NULL; struct node* second = N...

Why does Moore's Law necessitate parallel computing?

This was a question in one of my CS textbooks. I am at a loss. I don't see why it necessarily would lead to parallel computing. Anyone wanna point me in the right direction? ...

Beginner question about Caesar cipher in C++

To start off, I'm four weeks into a C++ course and I don't even know loops yet, so please speak baby talk? Okay, so I'm supposed to read a twelve character string (plus NULL makes thirteen) from a file, and then shift the letters backwards three, and then print my results to screen and file. I'm okay with everything except the shifting...

How do I round up currency values in Java?

Okay, here's my problem. Basically I have this problem. I have a number like .53999999. How do I round it up to 54 without using any of the Math functions? I'm guessing I have to multiply by 100 to scale it, then divide? Something like that? Thanks guys! EDIT: more info The issue is with money. let's say I have $50.5399999 I know ho...

A Simple Assembly Input Question

This is my first post on this site. I am taking an X86 assembly class and I am having a bit of trouble with my second project. The project is very simple. The program needs to take in a simple string from the user and display it back. I have gotten the program to take input from the user but I can't seem to store it. Here is what I have ...

How to read in numbers as command arguments? *update*

I am supposed to produce a program for my computer science class that reads two integers and outputs the product, sum, etc. for the two integers. How can make it where the program reads any two integers input before the program is run? The output is supposed to look like this, with x and y being any variables typed in(we are using Cygwin...

Programming A Problem Solving

Hi, can you please come up on Problem Solving Challenges in Programming A Level, for my teacher gives me Problem Solving Challenge like this. Create a Program that allow the user to input 10 Numbers, the program shall sort the numbers so the it puts Highest Latest and Lowest First So it says the user input 10, 40, 59, 41, 49, 51, 5...

finding center of 2D triangle

(Yes, unfortunately, this is a homework question) I've been given a struct for a 2D triangle with x and y coordinates, a rotation variable, and so on. From the point created by those x and y coordinates, I am supposed to draw a triangle around the point and rotate it appropriately using the rotation variable. I'm familiar with drawing...

Read from main memory and cache in Assembly

So I am being taught assembly and we have an assignment which is to find the time difference between reading from memory and reading from cache. We have to do this by creating 2 loops and timing them. (one reads from main memory and the other from cache). The thing is, I don't know and can't find anything that tells me how to read from e...

Search times for binary search tree

Does anyone know how to figure out search time for a binary search tree(i.e. worst-case, best-case, and average-case)? ...

Time complexity of nested for loop

Hi, I need to calculate the time complexity of the following code: for(i=1; i<=n; i++) { for(j=1; j<=i; j++) { // Some code } } Is it O(n^2)? ...

How to call upon a gameOver method in a Java game when sprite "falls off" the screen?

I am developing a simple platform game in Java using BlueJ. Over the next few weeks I will be posting a few questions asking for help with this project as am not very proficient at programming. So I hope I don't become annoying and I would be very grateful if you can kindly help me. In my game I have a gameOver method which ends the ga...