Hi there
I'm just starting an assignment for uni and it's raised a question for me.
I don't understand how to return a string from a function without having a memory leak.
char* trim(char* line) {
int start = 0;
int end = strlen(line) - 1;
/* find the start position of the string */
while(isspace(line[start]) != 0) {
st...
What is the best book for a student learning about concepts such as NP-hard, NP-complete and P=?NP?
I've already got the CLR but it doesn't really cover these particular topics as thoroughly.
...
As a homework i need to make a webapp that will play an mp3 file and the user has to guess the name of the song or the band in a certain time.
My question is where can i get this songs? Is there any website that offers mp3's and an api from which i can get songs along with the band and the name? It doesn't have to be the whole song, in f...
Okay so I am trying to take in a list and sort it from greatest to smallest.
Example:
> (maxheap (list 5 6 2 1 18 7))
;output:
> (18 7 6 5 2 1)
So here's what I got so far:
(define (mkmaxheap heaplist)
(let ((max (mymax(heaplist))))
;mymax is a func that returns max number, it works
(let (( head (car heaplist)) (tail (cdr he...
Determine if all the digits of the sum of n -numbers and swapped n are odd. For example: 36 + 63 = 99, y 409 + 904 = 1313. Visual Studio builds my code, there is still something wrong with it ( it doesnt return an answer) can you please help me here?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Tex...
Hi, I'm trying to find a way to find the shortest path through a grocery store, visiting a list of locations (shopping list). The path should start at a specified startposition and can end at multiple endpositions (there are multiple checkout counters).
Also, I have some predefined constraints on the path, such as "item x on the shoppin...
Array reverse and Array Sort on an int array and store into another array using a delegate. We have to accept the elements from the user
...
i need the code for sorting of numbers in ascending order using visual c++ in the windows forms,the output comes on the forms text box and i am doing it in visual studio....
anyone please help...provide the code
...
class A implements Runnable{
B b=new B();
public void run(){
while(true){
System.out.println("H1"+Thread.currentThread().getName());
}
}
}
public class Test {
public static void main(String[] str){
A a1 =new A();
// A a2 =new A();
//
Thread t1 =new Thread(a1, "Vichi");
Thread t2 =new Thread(a1,"Vishu");
t1.start()...
I'm working on a homework assignment (a project), for which one criterion is that I must make use of polymorphism in a way which noticeably improves the overall quality or functionality of my code.
I made a Hash Table which looks like this:
public class HashTable<E extends Hashable>{
...
}
where Hashable is an interface I made th...
we have two databases of size n containing numbers without repeats. So, in total we have 2n elements. They can be accessed through a query to one database at a time. The query is such that you give it a k and it returns kth smallest entry in that database. we need to find nth smallest entry among all the 2n elements in O(logn) queries. t...
You need to use division and remainder by 10. Consider this example:
163 divided by 10 is 16, remainder 3
16 divided by 10 is 1, remainder 6
1 divided by 10 is 0, remainder 1
You'll notice the remainder is always the last digit of the number that's being divided. How do I do this in C?
...
Say you have a variable n1 which will be the value of three digits entered
how can i then without knowing what exactly will be input split n1 into 3 seperate integers to do futher calculations with?
...
Greetings. I am trying to write a recursive function in Java that prints the numbers one through n. (n being the parameter that you send the function.) An iterative solution is pretty straightforward:
public static void printNumbers(int n){
for(int i = 1; i <= n; i++){
System.out.println(i);
i++;
}
As a novic...
I have an Informix-SQL based Pawnshop app which calculates an estimate of how much money should be loaned to a customer, based on the weight and purity of gold. The minimum the pawnshop lends is $5.00. The pawnshop employee will typically lend amounts which either ends with a 5 or 0. examples: 10, 15, 20, 100, 110, 125, etc. They do thi...
Hi, Given an xml structure like this
<gesmes:Envelope>
<gesmes:subject>Reference rates</gesmes:subject>
<gesmes:Sender>
<gesmes:name>European Central Bank</gesmes:name>
</gesmes:Sender>
<Cube>
<Cube time="2010-03-26">
<Cube currency="USD" rate="1.3353"/>
<Cube currency="JPY" rate="124.00"/>
<Cube currency="BGN" rate="1.9558"/>
<Cube cur...
I have a silly error that I am unable to resolve. I try to debug, and when I debug I get the following error
ERROR "Visual Studio cannot start
debugging because debut target
'C:\Documents and
Settings\user\Desktop\programs6\HuricaneSeasonStatistics\bin\Debug\HuricaneStatistics.exe"
is missing. Please build the project
and...
<wsdl:definitions targetNamespace="http://www.webserviceX.NET/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.webserviceX.NET/">
<s:element name="ConversionRate">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="FromCurrency" type="tns:Currency"/>
<s:element minOccurs="1...
All,
I am trying to code a Connect4 game. For this, I have created a P4Game class and a P4Board class which represents the i X j dimensions of the Connect4 board.
In P4Game, I have the following:
public class P4Game{
//INSTANCE VARIABLES
private int nbLines;
private int nbColumns;
private P4Board [][] position;
//CONST...
I need serious help dividing the positive numbers and the negative numbers.
I am to accumulate the total of the negative values and separately accumulate the total of the positive values. After the loop, you are then to display the sum of the negative values and the sum of the positive values.
The data is suppose to look like this:
...