3,815 Topics
![]() | |
Fun game for the raging compulsive alchoholic gambler, such as myself. Although the game may vary among casinos, the basic premise is the user picks 10 numbers out of 80. The computer will randomly draw 20 numbers out of 80. If you matched with any of the computer picks, you … | |
[CODE] #include<stdlib.h> #include<conio.h> #include<stdio.h> #include<iostream.h> struct pro { int no; int btime; int atime; int stime; int etime; int wtime; int ttime; int rtime; }proc[100],junk; void sort(int n) { pro temp; for(int i=0;i<n;i++) for(int j=0;j<n;j++) { if(proc[j].atime>proc[j+1].atime) { temp=proc[j]; proc[j]=proc[j+1]; proc[j+1]=temp; } } } pro min(int n,int & t) { … | |
I want to study the Google algorithm for creating better on-page optimizations to make my site search engine friendly | |
Hello all! I'm currently enrolled in an Algorithms course at my local university and have a question over an assignment. Here is the assignment: Assignment 1 1. Give a big-Oh notation, in terms of n and m, of the running time of the following procedures, including your explanations: a. Procedure1(n) … | |
Hi guys I need help to write a algorithm for walking a dog for my ipt we are still learning but I don't know how to do it yet but if us can help me out it would be muchly appreciated | |
Hello I'm new here and I've been up two night's trying to figure out how to write a program that will convert numbers to word. If anyone can help please respond to the post. here is what I sort of figured out so far. As you can tell I'm still … | |
Hey again. Trying to add elements to a DList, this happens when I try to add the second car (500, Porsche). The whole insert algorithm sucks and am strongly considering trying to figure out a better one. This is what shows up in the console: Enter name of file with … | |
Firstly, I am not sure if this is the best place to ask the query. If no, please move it to the correct subforum. Now, coming to my doubt, an assembler converts assembly language into opcodes, right? Now, to perform the conversion, assembler needs a certain algorithm. Whats the algorithm … | |
I have this code for AlphaBeta implementation and have created versions of the required interfaces that work perfectly (I have debugged them quite thoroughly). Unfortunately my algorithm keeps returning an empty vector and score of 0. Here is the code: [CODE]#include <vector> #include <limits.h> using namespace std; typedef vector<unsigned char> … | |
been studying c++ for a while and downloading sample codes in the internet.I just wanna ask what is cpu.h for cause im running this program (see codes bellow)many times debug all other problem the only remaining thing is that when i run it (im using dev c++) it always says … | |
Hey guys. I am creating an ordered list using an array. Not an ArrayList or anything else. I can not figure out how to get all of the data from the OrderedList constructor to carry through to my "insert" method. Therefore, when I am checking if "count == 0" it … | |
My code has a successful build, but when I run it and type in my 5 numbers, it breaks. Any clue as to how I can fix it??? Much help will be appreciated. [CODE] #include <iostream> #include <sstream> #include <string> #include <ctime> #include <cmath> #include <math.h> #include <algorithm> using namespace … | |
My teacher assigned the class this: Create a simple Game Loop for the game Mastermind. (Search the Internet to refresh your mind on how Mastermind is set up.) Have your computer generate a random 5 digit number, as a string. Then the user must guess the number. Using the code: … | |
I'm suppose to follow this algorithm: 1. Declare all ordinary Variables 2. Prepare and initialize all arrays. 3. Prepare array to hold all item cost. 4. Initialize Array cost with 0.(using for()statement) 5. Compute cost of each item then store results to array cost.(using for()statement) 6. compute average cost(using for()statement) … | |
hi this is a course work question and i have tried multiple methods to get it to work so if you can show me where i'm going wrong i would greatly appreciate it. i have to read a 4 character input and create each of the numbers into a sort … | |
Hey guys, I'm making a little pokemon game in java and i've come across a problem. The basic algorithm i use for movement is as follows: - if the player has pressed a particular key set the speed(float) accordingly (if key stroke was up, X speed should drop (since i'm … | |
Hi all Please suggest an algorithm to find square root of a big number ( 100+ digits ) in C/C++.. Thank you | |
![]() | I have been assigned to write a program to print the calendar of a given year. Its almost complete, but, I haven't yet found a proper algorithm to find the first day of the year which is required by the function to print the calendar year. Will provide the code … |
Hi. I want to read through a file and search for variables saved in it. However if the stream reads the last char I got errors like EOF. For example the following code would not work as intended to : [CODE] bool BaseFileReader::Valid() const { if (!File.is_open()) std::cout << "\n\nERROR: … | |
I try to implement ford fulkerson algorithm but i have problems at my_alg function.I think the reason for this problem is find_edge function.since when i find the edge and increment its flow(asker_sayisi),at the next line it seems to be incremented but at the next line when i find the same … | |
I have to sort a large array of numbers wherein the numbers are random and range from 1 to 9,99,999...till the time the length of array is less than 2,00,000, all sorts work fine (i tried selection, insertion and quick sort)...but when the length of array is increased to 3,00,000 … | |
Hello dude. Happy New Year. I want to asking about generating primes algorithm. Can you advice tell me what the fast generating primes algorithm except Sieve of Eratosthenes algorithm? thank you. i want to apply the algorithm to my cryptographic system.. | |
Can somebody give me advice on how to create a recursive version of GetEnumerator()? The well-known Towers of Hanoi problem (see e.g. [url]http://en.wikipedia.org/wiki/Tower_of_Hanoi[/url]) may serve as an example that is comparable to the actual problem I have. A simple algorithm to show all moves for a stacjk of disks of … | |
Ive been assigned a project where by i must find an MST via Kruskals algorithm. The problem I'm having is that I've been instructed to make a forest: "The forest can be implemented as a 2-D array of Boolean values (or as an array of linked list if you prefer). … | |
I am making a program for my week 1 programming II class. The assignment is... Create a structure for a classroom. Make sure it includes the following: Room Number, Lecture Name, List of Students, Number of chairs, Window (Yes/No), Projector (Yes/No), Available(Yes/No). Instructions: • Create functions that allow you to … | |
Can anyone explain why I can't sort this vector: [code] #include <iostream> #include <vector> #include <algorithm> #include <memory> struct Test { public: Test(const unsigned int input) : a(input){} int a; }; struct SortFunctor { bool operator()(std::shared_ptr<Test>& object1, std::shared_ptr<Test>& object2) { return(object1->a < object2->a); } }; ////////////////////////// int main (int argc, … | |
I have been teaching myself algorithms and I am stuck with the AlphaBeta AI algorithm. I want to test my knowledge of it with a TicTacToe simulation. The thing is I want it to be easy to modify for any two player game and I cannot figure out how to … | |
i`ve done a few codes and i compile it so that i can review it but it got stuck when i want to assign a room. i dont know why.. can someone please help me to fix this please...[CODE]#include <iostream> #include <vector> #include <cstdlib> #include <set> #include <algorithm> #include <string> … | |
OK, first off I have figured out the prime number algorithm...I guess. What I am needing help with, or wanting the answer to, is how to count how many primes are being displayed. To wit: Enter a Number: 10 There are 4 Primes. The Primes are: 7 5 3 2 … | |
What are the latest trends in steganography (hiding message in another medium e.g. digital images, videos, sound file) and steganalysis(detecting presence of message in a file) in jpeg images? Is there a way to perform steganography or is there an existing steganography algorithm where the message will not be destroyed … | |
[CODE]#include<iostream> #include<fstream> #include<string> #include<vector> #include<algorithm> using std::cin; using std::cout; using std::string; // clothing codes struct codes { char code; const char* explanation_1; float total_sales; }; codes CODES[]={'A',"BABY WEAR",0.0F, 'B',"CHILDREN WEAR",0.0F, 'C',"LADIES WEAR",0.0F, 'D',"MENSWEAR",0.0F, 0,NULL,0.0F }; struct RECORD { char category; int item_number; float price; }; const string filename="jualan.dat"; int menu(); … | |
[B]I was trying to create an application implementing the Douglas Peucker algorithm in VB.NET. I already finished coding the program and tried to compile it but when I try to draw on the form, it is not working. My source code is below, I just want to ask if there … | |
I've been fiddling with some boost spirit stuff, and my code seems to start infinitely looping somewhere in the standard library stuff. Any ideas what's wrong? The qi::phrase_parse works very well, but the karma gets me. [code] #include <iostream> #include <string> #include <vector> #include <algorithm> //#include <boost/spirit.hpp> #include <boost/spirit/include/qi.hpp> #include … | |
Hello, all. I am in the process of writing a peg solitaire solver in Python. It will allow the user to select the shape of the board in the future but for now I'm testing it with a standard 5 row triangle game, like the ones you find in Cracker … | |
Question:I am not able to start the codes of project in c++. Your clock has gone dead because you forgot to wind it or replace the battery, or you had a power outage. This clock has hands, so you must turn them to adjust the time. Which way, and how … | |
Writing a small program that requires me to convert strings to doubles and then back to strings. Right now, the code compiles but the answer is wrong, even though I am using an algorithm that I know is right in C++. Can someone tell me what I'm doing wrong? The … | |
[CODE]#include <iostream> //standard input and output #include <fstream> //file input and output #include <string> //for strings #include <exception> //catches exceptions #include <sstream> //stringstream comes from here #include <algorithm> #include <stack> #include <queue> using namespace std; bool writeFile(const string &data); //writes strings to file bool readFile(); //read file bool palin(const string … | |
This is actually an Objective-C question. I'm trying to implement a way to loop through pixels and map the colors to "curve" data. I was wondering the easiest way to do this. Is there a prewritten algorithm for curves anywhere? I don't want a graphical curve grid, I just need … | |
Hi guys, I am transferring figures between a Neural Network and a Genetic algorithm. This means I have to do some scaling. I have found out how to scale to produce a value between 0 and n but not between -n and n or x and y. So all in … | |
Hi, please, I want the shortest path algorithm using arrays (Data structure) and the path passing through all the points once and return back to the initial point. ex: 0-1-4-2-3-5-0 (path cost=10) 0-3-2-5-4-1-0 (path cost=15) so 0-1-4-2-3-5-0 is the correct answer. | |
[CODE] #include<stdio.h> main() { int array[100], n, c, d, swap; printf("Enter number of elements\n"); scanf("%d", &n); printf("Enter %d integers\n", n); for ( c = 0 ; c < n ; c++ ) scanf("%d", &array[c]); for ( c = 0 ; c < ( n - 1 ) ; c++ ) … | |
Hi! I'n new here, I hope I benefit a lot during my stay. So basically, after a few months I'll be starting my dissertation for my Masters degree in Computing. I want to know what exactly do I have to do? Like do I have to make a significant contribution … | |
Hello, I wrote two programs which sort first names which are already sorted by their last names.One is with Selection sort and the other is with Quicksort! The question is , "is any one of them stable?." "If the names with same first names are still in sorted order by … | |
[COLOR="green"]10 Coins Puzzle[/COLOR] Hello Friends, I m facing problems in coding of 10 coins Puzzle. I have made it, but the process was not good enough. I think there is a recursive process to sole this problem, but i couldn't get it. Plz help me out with efficient algorithm/code. | |
hello all, i have some calculation codes class in my client side, how my server gonna get those values and display it in my server? i had created windows forms labels in server. know i have the calculation class and main client forms in my client side, and main server … | |
![]() | Hey guys, I wrote a 'bigger' program that uses a basic algorithm to crypts a text I input from keyboard, or from another text file. I have divided the program in the 'working' part and the 'non-working' part. The keyboard input is great, it works perfectly. But when I try … ![]() |
Hey, I'm studying for a final exam and I came across an old question asking to give an algorithm that runs in [TEX]O(logn)[/TEX] and deletes an arbitrary element from an [TEX]n[/TEX] element [B]Min-Heap[/B] if given its index. I was thinking the right approach would be to use Hash table for … | |
I am in desperate need of help... I were to create Operating System's Shortest Job First Preemptive Algorithm .... The problem is that I am not getting how to calculate the average waiting time of each process... HELP ! SJF.java: [CODE] import javax.swing.JOptionPane; import java.util.*; public class SJF { int … | |
I have a Graph that I'm making using an adjacency matrix to hold edge values. The noEdge value is zero and all edgeweights are positive integers. I have to delete a node from this graph and I'm having trouble figuring out how to update the Adjacency matrix after the deletion … | |
As I stated in the title i am having the issue where the object 'bj' does not call any of the functions that are within the class. I am stuck on this issue. Any help will be a appreciated. Thanks in advance. [CODE]#include <iostream> #include <cstdlib> #include <ctime> #include <string> … |
The End.