homework

Modifying this 8-puzzle code to print the intermediate states to reach the solution

About the 8 Puzzle Problem // Breadth First Search Usage in the common Eight Puzzle Problem. import java.util.*; class EightPuzzle { Queue<String> q = new LinkedList<String>(); // Use of Queue Implemented using LinkedList for Storing All the Nodes in BFS. Map<String,Integer> map = new HashMap<String, Integer>(); // HashMap...

C# code: go through list of words and search through a folder to find file containing that word

Hi, please help me with following programming exercise.. Lets say I have a text file MyFile.txt with following content hellosam whatsup mynameisjohn ... I want to go through each word in MyFile.txt and then see which file in my local folder c:\myfolders\myallfiles contain that word. For example, I want to see which file would conta...

Double Linked Lists in C++

NOTE: THIS IS FOR HOMEWORK SO PLEASE DO NOT INCLUDE BLOCKS OF CODE IN YOUR ANSWERS I have an assignment that requires us to implement a doubly linked list class. For some reason they defined the node struct as follows: struct node { node *next; node *prev; T *o; }; It seems to me that it would be a lot easier to write ...

How to find determinant of large matrix

I found some C++ code for finding the determinant of matrix, for 4x4 to 8x8. It works ok, but my project needs matrices that are 18x18 or more, and the code is too slow. The code is recursive, but is recursion the right concept to deal with an 18x18 matrix? How else can I find the determinant? ...

self joining a table

Basically when do we need a self join on a table? ...

find row of matrix with most numbers < 10 method.

Hi, I cant imagine how to create this method: I can find numbers<10 with if loop and store them with count++; But thats all. Id like to see the algorithm in any lang(I can do some C++,java), so I can use it. Go through each row and record a count of numbers less than 10. Store that aside, go to next row, do same thing, compare, throw o...

dreamweaver button link CSS help

Hey guys I'm currently having trouble with my CSS linking. Basically I want the colour of my links to change when I hover over them, and click on them and such. But for some reason it is not working when I view it on a browser. Below is my HTML code and my CSS code, they are seperate files and are linked togather. Thanks in advance. (I a...

polling of childs stdout stops setting POLLIN after first read

I want to read the output of my child's proccess, but for some reason it stops setting the POLLIN in revents when there is still output to be read. Here is what I do: Fork my process create pipe dup2(pipe[0],STDOUT_FILENO) my child's stdout poll the file descriptor of the pipe(I do this until I reach EOF) read output if POLLIN is se...

optimized indexed array search for greater-than number

I have an array of sorted numbers: pts = [ 0, 4, 25, 51, 72, 100 ] Given value T, I need to find the index of the first number in the array greater than T. if T = 2, then the correct index is 1 for value 4 dumb solution I can do this with a linear search, but would like to optimize. not working solution Binary search algorithm e...

sum of series 1*3-3*5+5*7

please help to print series as well sum of series like 1*3-3*5+5*7 up to n terms i have used code like this in php class series { function ser(){ $i = 0; $k = 3; $m = 0; for($j = 1; $j < 3; $j++) { if($j % 2 == 0 ) { $m = $i + ($i * $k); } else { ...

BufferedWriter java

Write a program to keep your friends telephone numbers. You should be able to; Add a new name and number (Look up a number given a name) Save the data to an object file when you terminate the programme Restore the saved data when the program is rerun the part i am confused about is in the brackets above cla...

[C Program] How to count the numbers of digit from a file ?

It's error. What's wrong of my codes? #include "stdafx.h" #include "stdlib.h" #include "ctype.h" int _tmain(int argc, _TCHAR* argv[]) { FILE* input; int num; int numCount = 0; input = fopen("123.txt", "r"); if (!input) { printf("No file \a\n"); exit (101); } while ((fscanf(input, "%d", &num)) == 1) ...

c++ operator overloading

hello .. i'm not sure if what im talking about is an operator overloading question. is it possible to overload keywords in C++?? for example : i need to write loopOver(i=0; ;i++) instead of for(i=0;;i++) ?? is that possible in C++ and i need to have something like 2 addTo 2 instead of 2 + 2 please help thanks in advance ...

How to make the bytes of the block be initialized so that they contain all 0s

I am writing the calloc function in a memory management assignment (I am using C). I have one question, I wrote the malloc function and thinking about using it for calloc as it says calloc will take num and size and return a block of memory that is (num * size) which I can use malloc to create, however, it says that I need to initialize ...

What does "hard coded" mean?

Hi guys. I gotta problem, it's just a lil one. I have like three assignments due tomorrow night but in order to do two of them, I have to be able to access a test.txt document from my IDE. To do that, the file has to be hard coded to my C drive. I have no idea how to do this. Can somebody please help me with this? I would really apprecia...

whats the genetic algorithm code for shortest path between nodes?

whats the genetic algorithm code for shortest path between nodes? ...

Optimal Search criteria in this array?

I just wrote this exam, in which there was question: Consider a array of size 2n, where the numbers in odd positions are sorted in ascending order and the the numbers in even positions in descending order. Now, if I have to search for a number in this array, which is a good way to do this? The options were: Quick sort and then binary s...

I am writing a function to do "while" , but why error?

I am writing a function to do "while" to count the numbers of alphabetic and digits in a text file. I would like to seperate it to 2 functions of 2 "while". But it error after I create the first function. What's wrong of it? #include "stdafx.h" #include "stdlib.h" #include "ctype.h" void countDig (FILE* input, char num,...

calling a method in which way?

I want to make connection between two parts of my program which can be located in departed places. I have some choices for making this connection: using PRC/RMI: in every request a calling method will send to second part using normal function call using queue(in memory):every request will be placed in a queue and second part will get t...

counting letters in a text file

Can sommebody please tell me what is not right about this code? It compiles and everything great but the output is solid zero's all the way down. So it is not counting the letters. #include <iostream> #include <fstream> #include <string> using namespace std; const char FileName[] = "c:/test.txt"; int main () { string lineBuffer...