homework

[java] Making non-graphical Histogram from array values.

Via the starPrint method I need to make the frequency of each number populated in the array display in a histogram as such: 1=3*** 2=4**** 3=7******* and so on. It needs the number of stars populated that are equal to the frequency of the number appearing! At the moment I'm getting the number of asterisks of the length of the array. ...

[java] Populating an Array after a nested loop.

Under the addRolls method I need to populate the nums array with the frequency of the 'total' variable numbers. These method adds the two dice rolls together properly and stores it in the 'total' variable but I cannot seem to properly throw them into an array that does the frequency such as the method above it - indFreq. In case that'...

test if a& b==0

I want to implement a program which tests if a&b==0 . It should return false if the two integers have at least 1 bit in the same location and true if they have 1 bit in different locations. Here is my code: import java.util.*; public class btest{ public static boolean testand(int a,int b){ int i=0; int k=0; int m=0; while(i<32){ k=...

Find substring matches

Write the function subStringMatchExact. This function takes two arguments: a target string, and a key string. It should return a tuple of the starting points of matches of the key string in the target string, when indexing starts at 0. Complete the definition for def subStringMatchExact(target,key): For example, subStringMatchExact("...

awk and sed + append text after last line in file

how to append text line after the last line in file without using echo command need example in sed and awk THX yael ...

Condition for single bit code for a character in Huffman code?

This is a question I ran into in school settings, but it keeps bugging me so I decided to ask it here. In Huffman compression, fixed-length sequences (characters) are encoded with variable-length sequences. The code sequence length depends on the frequencies (or probabilities) of the source characters. My questions is: what is the mini...

Sorting arrays in Java using the flag-sort

Write a static method in Java : public static void sortByFour (int[] arr) That receives as a paramater an array full of non-negative numbers (zero or positive) and sorts the array in the following way : In the beginning of the array all the numbers that devide by four without a remainder will appear. After them all the numbers in th...

How do I interleave strings in Python?

How do I interleave strings in Python? Given s1 = 'abc' s2 = 'xyz' How do I get axbycz? ...

Access private variable in global scope

For a school assignment I have to find a solution to the following problem; In this below code, the foo function in the global scope tries to access the private variables of a Box, which ofcourse doesn't work. I have to make the foo function work with one line of code at the place show code. #include <iostream> using namespace std; c...

What do Iterator and Iterable mean?

What are the meanings of "iterator" and "iterable", and what are the benefits of using them. Please answer as I have an exam tomorrow. ...

populate my data structure with thousands of real english words

I need to test my data structure (in java) which is like a dictionary - holds a key/value map. I would like to know how do you test your data structure? I would like to insert real words in my data structure and then find them. I am wondering if there is a way to download all the english words and then I can read that file and populate m...

ARM - Infinite Loop While Searching String

Can anybody point out why? I can't see the problem. String to search: "aassaas" String to search with: "as" SEARCHSTRING: STMFD SP!, {R4-R7, LR} MOV R6, #0 @Matches found MOV R3, #0 @Placeholder LOOP: LDRB R4, [R0] @R4 = String to search LDRB R5, [R1] @R5 = String to sear...

explain that code

Someone can explain that code please ? using System; class Program { static int[] p = new int[4] { 2, 3, 5, 7 }; static double sum = 0, max = Math.Pow(10, 100); static void Main(string[] args) { for (int i = 0; i < p.Length; i++) f(1, p[i], i); Console.WriteLine(sum); } static void f(double produit, int val, int po...

C Operator precedence (x[i] = --i)

Possible Duplicate: Could anyone explain these undefined behaviors (i = i++ + ++i , i = i++, etc) I am wondering if x[i] = --i is defined by C standard. I tested it with g++ and it looked like x[i] was resolved before i was decreased. Is this a standard? And can you give me some more information about how is this evaluated. ...

Who is the primary actor of an automated system?

In an automated black box trading application who should be identified as the primary actor in the use cases? Is it the system itself or the system administrator or the organization who has a vested interested in the system? ...

foo(foo(x)) = -x

Possible Duplicate: Interview question: f(f(n)) == -n Like I wrote above, implement a function whose prototype is int foo(int n); such that foo(foo(x)) returns -x ...

simple data masking in C#

Is there a simple algorithm where by I can convert an numeric value to alphanumeric and reliably convert back it to the same numeric ? ex: 12345 -> 00A3DF -> 12345 Thanks ...

help me with priority stack in C#

hey there I want to create a stack which will have the following methods: getValueOf ("key") getKeyOf ("value") addKeyAndValue ("key" "value") delete ("key") can anyone please help me as I am very new to C sharp ...

What agile method do you use? What agile methods are the most common?

I am taking a software development class right now and we are discussing agile methodologies. What are the most common agile methods? I need to look into several and discuss their strengths and weaknesses. Seems more useful to look into the most prominent methods. Observations: Scrum seems pretty popular (that is what my team used...

Java -- Read from std input, one char at a time

I'm having trouble determining the best way to read some input in for a java program. It needs to read in the individual characters of a roman numeral, and then perform some operation on it. There are, however, several catches. The input must be read from the standard input, because input redirection is being used. Additionally, I need...