homework

Are foreign keys really necessary in a database design?

As far as I know, foreign keys (FK) are used to aid the programmer to manipulate data in the correct way. Suppose a programmer is actually doing this in the right manner already, then do we really need the concept of foreign keys? Are there any other uses for foreign keys? Am I missing something here? ...

What is the best way to learn recursion?

When I started in programming I started with c++ and was doing recursion in my second semester in a data structures class. I don't even remember how we started it, I think it was linked lists, but its a concept that I picked up easily and can jump into quickly, even when I haven't written any recursive code in quite some time. What is t...

Print Odd-Even numbers using signals

The problem is to print natural nos. 1,2,...n such that the parent process prints all odd numbers and child all even numbers using POSIX signals. Output should be: Parent : 1 Child : 2 Parent : 3 and so on...any suggestions? ...

Interesting interview questions

Not so long ago I was in an interview, that required solving two very interesting problems. I'm curious how would you approach the solutions. Problem 1 : Product of everything except current Write a function that takes as input two integer arrays of length len, input and index, and generates a third array, result, such that: result[...

How to identify specific digits of an integer input in C?

I have a lot of java background and am new to C. If the input integer is 11031, I want to count the number of 1's digits, how would I do this? I know in java I can take the input as a String and use charAt, but I understand there is no implicit String function in C... ...

What is a good algorithm for deciding whether a passed in amount can be built additively from a set of numbers?

What is a good algorithm for deciding whether a passed in amount can be built additively from a set of numbers. In my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is a simple example, but the algorithm needs to work fo...

Database design for a booking application e.g. hotel

I've built one, but I'm convinced it's wrong. I had a table for customer details, and another table with the each date staying (i.e. a week's holiday would have seven records). Is there a better way? Many thanks. I code in PHP with MySQL ...

Using Stack as Queue

Suppose we have two stacks and no other temporary variable . Is to possible to use it as a queue provided we have associated API i.e push,pop for stack and insert and remove for queue operations. ...

Hidden Markov Models

Hi, I want to get started on HMM's, but don't know how to go about it. Can people here, give me some basic pointers, where to look? More than just the theory, I like to do a lot of hands-on. So, would prefer resources, where I can write small code snippets to check my learning, rather than just dry text. Will be hoping to see some rep...

Why is quicksort better than mergesort?

I was asked this question during an interview. They're both O(nlogn) and yet most people use Quicksort instead of Mergesort. Why is that? ...

How do I capitalize first letter of first name and last name in C#?

Is there an easy way to capitalize the first letter of a string and lower the rest of it? Is there a built in method or do I need to make my own? ...

How do I clip a line segment against a frustum?

Given two vectors A and B which form the line segment L = A-B. Furthermore given a view frustum F which is defined by its left, right, bottom, top, near and far planes. How do I clip L against F? That is, test for an intersection and where on L that intersection occurs? (Keep in mind that a line segment can have more than one intersec...

What is a multitasking operating system?

What are the characteristics of a multitasking operating system? What makes it multitasking? Are there non-multitasking operating systems? ...

What is round-robin scheduling?

In a multitasking operating system context, sometimes you hear the term round-robin scheduling. What does it refer to? What other kind of scheduling is there? ...

software Engineering documentation

Can anyone suggest where can i find the best software engineering project documentation. I need to do on project for my studies. If i had an sample project would have saved lot of time for me. ...

Algorithm to find which numbers from a list of size n sum to another number

I have a decimal number (let's call it goal) and an array of other decimal numbers (let's call the array elements) and I need to find all the combinations of numbers from elements which sum to goal. I have a preference for a solution in C# (.Net 2.0) but may the best algorithm win irrespective. Your method signature might look somethin...

How do you solve the 15-puzzle with A-Star or Dijkstra's Algorithm?

I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle". Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms? If I were to treat each no...

Creating a java servlet web application

We have to create a web application for a school project and I'm wondering what best practices are when creating a web application using java servlets, beans and jsp. Specifically I'm curious about servlets. Should a single servlet be created with many methods depending on which page is requested (a single controller) or should a servle...

Separation of Concerns

What is separation of concerns? What's a concern? How might one partition an app into these "different concerns"? ...

Algorithm to detect similar documents in python script

i need to write a module to detect similar documents. i have read many papers of fingerprints of documents technique and others but i do not know how to write code or implement. the algorithm should work for Chinese, Japanese, English and German language or language independent. can you help me. or sending me code for this problem i am ...