G'day guys,
Trying currently to finish up a bit of homework I'm working on, and having an issue where I'm trying to apply map across a function that accepts multiple inputs.
so in the case I'm using processList f (x:xs) = map accelerateList f xs x xs
processList is given a floating value (f) and a List that it sorts into another List
...
I need to make a linked list with classes. Each list will store two values: a URI and IP. After doing all the adding, I need to be able count the total number of items in the linked list. I have tried the following code but it doesn't compile. We are not allowed to use std::list. Any suggestions please?
#include <iostream>
#include <cst...
One last question for the evening, I'm building the main input function of my Haskell program and I have to check for the args that are brought in
so I use
args <- getArgs
case length args of
0 -> putStrLn "No Arguments, exiting"
otherwise -> { other methods here}
Is there an intelligent way of setting up other methods, or is...
In the university we were given the following code sample and we were being told, that there is a memory leak when running this code. The sample should demonstrate that this is a situation where the garbage collector can't work.
As far as my object oriented programming goes, the only codeline able to create a memory leak would be
ite...
struct Record_node* Sequential_search(struct Record_node *List, int target) {
struct Record_node *cur;
cur = List->head ;
if(cur == NULL || cur->key >= target) {
return NULL;
}
while(cur->next != NULL) {
if(cur->next->key >= target) {
return cur;
}
cur = cur->next;
}
...
I'm trying to build a simple application, with the finished program looking like this :
I will also have to implement two different GUI layouts for this. Now I'm trying to figure out the best method to perform this task. My professor told me to introduce Element class with 4 states :
- empty
- invisible (used in GridLayout)
- first le...
Hi,
How can i addition one + one matric (array data structure) and after it find the third smallest number in it in C language (not C++)? Thank you for the code.
...
#include <iostream>
#include <string>
using namespace std;
// Turns a digit between 1 and 9 into its english name
// Turn a number into its english name
string int_name(int n)
{
string digit_name;
{
if (n == 1) return "one";
else if (n == 2) return "two";
else if (n == 3) return "three";
else if (n == 4) retur...
Hi, I'm a real beginner with PHP & mysql.
Just for studying and for a simple example at school I would like to work this simple query and possibly output all the rows (or maybe even one) to a very basic output on a php page:
<?php
$user= "root";
$host="localhost";
$password="";
$database = "PetCatalog";
$cxn = mysqli_connect($host,$user...
import java.util.Scanner;
import java.lang.String;
public class SA3
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.print("Enter student record : ");
String scores = scan.nextLine();
String[] StringOfMarks = scores.split(",");
double[] M...
How can I convert a number contained in a string from any base to any other base?
Bases can be anything i.e.: 2, 16, 10, 4, 8, 9.
I'm expecting the user to enter the base number. The user will enter the output base (the base to be converted to). The user will enter the number he wants to convert.
Pre thoughts:
I will save the input b...
I have a Java project where I am to connect to a database and create buttons (next, new, save, delete, previous) to navigate through the database content where there are appropriate text fields and labels for the specific information.
I'll use the code below as an example (each button is set up very similar)... I have it as follows:
JB...
I'm trying to implement user threads on a 2.4 Linux kernel (homework) and the trick for context switch seems to be using an alarm that goes off every x milliseconds and sends us to an alarm handler from which we can longjmp to the next thread. What I'm having difficulties with is figuring out how to save the environment to return to late...
B=[1 1 1 1 1 1....1] % vector of length N elements
Xk= sin(2*pi/16)
i need to find function alpha(l,k) which is having two variables l and k and a condition given that alpha(l,0)=alpha(l,-1)=alpha(l,-2)......=alpha(l,-(N-1))=0 i.e no matter what value of l ,alpha = 0 for past values
A= input('no of iterations'); % no. of iterations ...
I have a table with three columns:
patient_id
obs_date
weight_val
patient_id stores patient identification #, weight_val stores a weight value, and obs_date stores the date when the weight reading was taken. So, a patient can have many different weight readings at different dates.
How do you write a query for:
select all patient...
Hi guys, I am helping my nephew for his C lab homework, it is a string manipulation assignment and applying Wang's algorithm.
Here is the BNF representation for the input.
<s> ::= <l> # <r>
<l> ::= <list>| ε
<r> ::= <list>| ε
<list> ::= <f>|<f> , <list>
<f> ::= <letter>| - <f>| (<f><op><f>)
<op> ::= & | | | >
<letter> ::= A |... | Z
...
Hello,
I've just started studying and I need help on one of my exercises.
I need the end user to input a rain fall number for each month.
I then need to out put the average rainfall, highest month and lowest month and the months which rainfall was above average.
I keep getting the same number in the highest and lowest and I have no ...
A few simple marks for those who know the answer.
I'm doing revision for exams at the moment and one of the past questions is:
What is meant by the order of a perceptron?
I can't find any information about this in my lecture notes, and even google seems at a loss.
My guess is that the order is the number of layers in a neural net...
Need some compact code for counting the number of lines in a string in Java. The string is to be separated by \r or \n. Each instance of those newline characters will be considered as a separate line. For example,
"Hello\nWorld\nThis\nIs\t"
should return 4. The prototype is
private static int countLines(String str) {...}
Can someo...
Hi. I'm working on my C++ assignment about soccer and I encountered a problem with map.
My problem that I encountered is that when I stored 2 or more "midfielders" as the key, even the cout data shows different, but when I do a multiplication on the 2nd ->second value, it "adds up" the first ->second value and multiply with it.
E.g.
J...