homework

Presenting Data In A Tree Form

Hello Guys, I am stuck in my project for a while and decided to contact you guys for ideas because am short of ideas how to get it done. This is the task: I have information like this from the server and have to present the information in a tree form structure to the user. The data from the server comes in this form: APP net ...

C Program to search n-th smallest element in array without sorting?

Hi all, I wanted to write a program to find the nth smallest element without using any sorting technique.. Can we implement it as a technique used in quick sort, which divides the problem into smaller sub-problems but how is my question.. Please provide some hint.. Thankx ...

Algorithm for Determining Tic Tac Toe Game Over (Java)

I've written a game of tic-tac-toe in Java, and my current method of determining the end of the game accounts for the following possible scenarios for the game being over: The board is full, and no winner has yet been declared: Game is a draw. Cross has won. Circle has won. Unfortunately, to do so, it reads through a predefined set o...

Calculating Digital Root, is there a better way ?

Hello This is how i calculated the digital root of an integer. import acm.program.*; public class Problem7 extends ConsoleProgram { public void run() { println("This program calculates the digital root of an interger."); int num = readInt("Enter the number: "); int sum = 0; while (true) ...

Big O help

If i had a function like this... void myfunction(node* root) { for(int i = 0; i<root->children.size();i++) { myfunction(root->children[i]); } } granted thats just the part of the function I have a question on, but would that be n^2 or just n, for big O? I guess the question is if you have a for loop and inside that for...

hi i need help with c# array problem

hi im preparing for an exam and i am new to c# i am having problem with a question that i have what i am having problem is that i need to find out how many times the number greater than or less than one appears in the array for example if i have an array {1,1,1,2,3,-18,45,1} here numbers that are greater than or less than one appears...

c program to print each word in a sentence

Hi, Can you help me with this? I want to accept a sentence from the user and print each word in the sentence to the user.... I need a C program to do this! ...

a loop in a loop to fill an array? ( OpenFlashChart )

For my school project I am buiding a time registration program. It is my first in ruby on rails, so even the simplest things are hard . ;) The situation: Users can work on a project, and I want to display in a chart how many hours each user worked on a project, let's say, each month. The chart plugin works like this: first_serie = O...

How to split long strings into fixed array items in C#

I have a dictionary object IDictionary<string, string> it only has the following items: Item1, Items2 and Item3. Each item only has a maximum length of 50 characters. I then have a list of words List<string>. I need a loop that will go through the words and add them to the dictionary starting at Item1, but before adding it to the dictio...

how to make my program not run on other computers? (C#)

I have an assignment, and it has (amongst others) two demands: make an installer make it so that if it is installed on one computer, anyone trying to run the same files on another computer will fail. I'm using VS9 (2008) express, I think I can do the installer part, but I'm not sure how to do the "security" part. I don't need any har...

need help with c# , fibonacci

hi , urm... i am practising c# console application , and am trying to get the function to verify if the number appears in a fibonacci series or not but im getting errors what i did was class Program { static void Main(string[] args) { System.Console.WriteLine(isFibonacci(20)); } static int isFibonacci(int n) ...

use case steps and use case scenrios

hey guys! I am modelling a system and i have the following are some of my use cases{appoint teacher(adimin),record grades(teacher), manage students(admin),record attendance(teacher), manage cocurricular(admin)} I have some problems with coming up with use case steps and use case scenarios. i have already drawn my conceptual class diagram...

Reverse a sentence in C??

Hi, I had just written a programme which reverses a sentence whatever the user gives. for eg:If the user gives the sentence as "How are you",my programm generates "uoy era woH". The programme which i had written is shown below.I just have a wild intution that there can be a smarter programe than the one which i had written.So valuab...

How to write a word to beginning of each line in a notepad txt file? C++

I want to write a word to each line before all the words. DATA.txt { ie. Hello my name is steven ie. 1.hello 1.my 1.name 1.is 1.steven } IN FILE I/O to put the number 1 and a dot before all the words in the beginning of the line Ok i want it to find the string then ut the certain text "...

How to print output using python?

I have been working on this particular assignment and ran into one issue. I'm fairly new to python and needed a quick fix. When this .exe file runs it prints a screen full of information and I want to print a particular line out to the screen here line "6". cmd = ' -a ' + str(a) + ' -b ' + str(b) + str(Output) process = Popen(...

Java area class

Please help - I'm new to java. I'm working on a code for class that ask me to write an Area class that calcualtes the following shapes-circles-rectangles-cylinders Area of a circle: Area= (TT)(r^2) where TT is Math.PI and r is the circle radius Area of a Rectangle: Area= (width) * (length) Area of a cylinder: Area= (TT)(r^2)(h) where...

Given an array of numbers, except for one number all the others, occur twice. Give an algorithm to find that number which occurs only once in the array.

What I can think of is: Algo: Have a hash table which will store the number and its associated count Parse the array and increment the count for number. Now parse the hash table to get the number whose count is 1. Can you guys think of solution better than this. With O(n) runtime and using no extra space ...

Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. Now speed it up. Now test it.

Algo: (considering language used will be c#) Convert both strings into char array take the smaller array and generate a hash table for it with key as the character and value 0 Now Loop through the other array and increment the count in hash table if that char is present in it. Now take out all char for hash table whose value is > 0. Th...

MultiThreading and Deadlock

suggest me any real time situations in which i'm supposed to create multiple threads,and then introduce a deadlock situation.this is kind of a project!!! can u ppl help to make the application more interestin with some real time situation... ...

How can the processor recognize the device requesting the interrupt?

1) How can the processor recognize the device requesting the interrupt? 2) Given the different devices are likely to require different ISR How can the pressor obtain the starting address in each case? 3) Should a device be allowed to interrupt the processor while amother interrupt is being services? 4) How should two or more simultanemen...