3,815 Topics
![]() | |
[red][b]Shell Sort[/b][/red] [code] void shellSort(int numbers[], int array_size) { int i, j, increment, temp; increment = 3; while (increment > 0) { for (i=0; i < array_size; i++) { j = i; temp = numbers[i]; while ((j >= increment) && (numbers[j-increment] > temp)) { numbers[j] = numbers[j - increment]; j … ![]() | |
In my program I have a loop with a variable that shows the players name, they choose something then it goes back to display their name and all it shows is arrows.... why? I'll post my code, run it and enter 3 or 4 players are playing, give them some … | |
I was wondering how I could access my several countryAttachedXX arrays(in this post they start on line 85), without many if statements, determined by user input. I was thinking maybe an array of arrays, but had difficulty finding out how to do that on the web. Thanks, -Matt [code=cplusplus]/**************************** * … | |
I am trying to make a text version of risk, and I need to store the population, or army count, for each country. So the only way I could think to do that, as you'll see in my code, is by making a variable for each country, and then storing … | |
I'm having some trouble with STL lists. What I want to do in my program is take the players initial and put it into an array at the spot that they got from when I divided up 20 numbers (0-19). Can anyone tell me why line 151 (in this post … | |
This codeblock comes from Mr Weiss's book "Data Sturucture and Algorithm Analysis in C++"(Third Edition). I have some questions about it. [code=c] /** *This is a member function from the BinarySearchTree class. *And It try to find whether there's a element equal to x in *the binary search tree. */ … | |
I need to do a non-recursive function for count the leafs in a tree. I have the recursive algorithm, Can someone help me to figure this out!! count leafs int count_Lnodes(root, int cnt) { if (root != NULL) { cnt = count_Lnodes(root->left, cnt); cnt = count_Lnodes(root->right, cnt); if (root->left == … | |
I have a project for which I have to implement parameter passing through stack between different protection levels. The information about the number of variables needed to be passed at the function must be given through DWORD Count of Call gate For this project I have to: A) Create 4 … | |
Hi im a beginner in vb.net. this is a console application. i would like to know how can i use system.timers.timer so that my application will check the file req.txt every 5 sec. any kind of help will do. here is my application. Module Module1 Sub Main() Dim FILE_NAME As … | |
can any body help me out wid this ........as i m doing C not C++.....plz tell me the whole program........plzzzzzzzzz Construct a solution algorithm and write a C program for the following programming problem. Use a top-down modular design. State clearly tasks that are to be performed by each module. … | |
Hi all, Please can u tell me what are the method involved in algorithm transforms? since I am working on DSP algorithms and i want to reduce the complexity which are written in c language so please help me to understand what exactly is the algorithm transform means? please give … | |
I came across a simple way of quicksorting linked list which is same as iterative version of quicksort for arrays... [url]http://www.openasthra.com/c-tidbits/sorting-a-linked-list-with-quicksort-simple-algorithm/[/url] worth a look... Let me know if you have any other simple algorithm for QuickSort (for sorting linked lists), should be easy to understand... Thanks. | |
[code=cplusplus] #include<iostream.h> #include<fstream.h> #include<cstdio> #include<typeinfo> #include<cstring> #include<sstream> #include<algorithm> #include<ctime> char* itoa(int n, char *buf,int) // { // ostring out; // out<<n; // strcpy(buf,out.str(),c_str(); // return buf; // } class string class const struct Node class VCDdetails { private: char vcdid[6]; char movietitle[50]; char castofmovie[50]; int numvcdcopy; public: void addVCDdetails() { … ![]() | |
i have a homework my homework is to place 8 quenns pieces from the game of chess on a chessboard so that no queen piece is threatening another queen on the board.All of the solutions can be found using a recursive algorithm.The algorithm works by placing queens on various positions,adding … | |
I guess it is postoffice shorting, does anyone know the algorithm?(need a simplified version) | |
Here is what I have so far Many professional sports teams use a computer to assist in the analysis of scouting reports on prospective players. The Kute and Kuddly soccer team is in need of such a system. You are to design an algorithm to accept the scouting data from … | |
I need help trying to compile and test this code, but I keep getting the error: template is incomplete, can not parse field. Here is my code: [code] #include<iostream> #include<iterator> #include<vector> #include<algorithm> using namespace std; template <class T> class my_istream_iterator { public: typedef charT char_type; typedef traitsT traits_type; typedef basic_istream<charT, … | |
im compiling a basic sorting algorithm that utilizies POSIX threads (pthreads) .... everything was compiling fine, until i put the thread implementation in .... all of a sudden, it gives me this: [code]-bash-2.05b$ gcc project4a.c -lpthreads project4a.c: In function `main': project4a.c:32: subscripted value is neither array nor pointer project4a.c:33: subscripted … | |
T=Φ while((T contains less than n - 1 edges) && (E not empty)) { choose an edge (v,w) from E of lowest cost; delete (v,w) from E; if ((v,w) does not create a cycle in T) add (v,w) to T; else discard (v,w); } if (T contains fewer than n-1 … | |
Hi, everybody, Before I ask for help I'd like to say thanks for all your help you've been really helpful. If anyone has the algorithm for the compaction technique used in fragmentation please post it in the Code snippets it would be very helpful to me please!! | |
Suppose you have a computer that requires 1 minute to solve problem instances of size 1000. What instance sizes can be run in 1 minute if you buy a new computer that runs 1000 times faster than the old one, assuming the following time complexities T(n) for our algorithm? (a) … | |
variations of this are being posted repeatedly here. hope this will clarify things once and for all. [code=c] // to choose a random element from a sequence when // a. you do not know how many elements are there before hand // b. you want to make one single pass … | |
[COLOR=#000000]Write a program that will input a positive integer and print out the list of its prime factors. Comment on the run time of your algorithm and state any limitations that you have imposed on the input integers[/COLOR] | |
Write a linear-time algorithm that sorts n distinct integers, each of which is between 1 and 500. Hint: Use a 500-element array. (Linear-time means your algorithm runs in time c*n + b, where c and b are any constants that do not depend on n. For example, your algorithm can … | |
Presently we can solve in our hypothetical machine problem instances of size 100 in 1 minute using algorithm A, which is a O(2n). this is 2 to power n We would like to solve instances of size 200 in 1 minute using algorithm A on a new machine. What is … | |
How many edges are there in a tree with 21 verticies? Also if that is not enough of an headache how about this. Can anyone help??? I am trying use the prism algorithm to find a minimal spanning tree for a weighted graph. The instuction are to (start at A) … | |
a) Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and calculate its complexity T(n).:-/ b) Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and with complexity T(n) is at most about (1.5)n … | |
i need make this program run..anyone can help me? [code=java] import java.util.*; import java.awt.*; import java.net.URL; class Prim extends CompleteEuclideanGraph { private ArrayList remainingPoints; //points not on MST private ArrayList completedPoints; //points on MST private Point[] chosen; //array of chosen points for each step private int bpoint = -1; //pointer … | |
Hey there^^ Just a quick sort out hopefully, ive been hacking at this for a good while and cant figure out whats wrong for thie life of me! I have a program that uses calculates the maximum deflection of a beam under load (with some assumptions were allowed); and im … | |
Hello, I need help with Lee algorithm. Just a quick reminder of what it is: Start at a point, assign the cost of 0 to that point, and expand vertically and horizontally until target is hit. See below: ______3 ____3 2 3 __3 2 1 2 3 3 2 1 … | |
"Write a program that has an array of at least 20 integers. It should call a function that uses the linear search algoritm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then … | |
I have a hw question that asks us to create an STL funciton that takes an argument of type map<string, int> and an integer and returns vector containin all positions in map for which the integer value is found. The function works from what I can test. But I wanto … | |
hi, I need the source code for algorithm gaussian recursive elimination method for mips R2000 language assembly. thank you.:'( | |
hi,i have to implement multiplication of two huge integers of 40 or more digits.i've made a function in a class for its implementation but its not working.plz help if u find any logical errors in it. [CODE]void HugeInteger::multiplyHugeIntegers(HugeInteger H1,HugeInteger H2) { int carry=0; int count=0; // introduced to place the … ![]() | |
I have a homework question in STL. The question asks to write an implementation of STL algorithm replace_copy_if(). My question is NOT regarding how do I code this, but more importantly what exactly does it mean? In other words, is it the same as just creating a function and not … | |
I ask this question because I want to try out some probability theories and I want to get as close as possible to randomness. What my instinct tells me is that we cannot fabricate any function that is perfectly random, because we are in the first place defining an algorithm … | |
Hello, I have been asked to provide an algorithm for the following: You are given an array of length N, which contains values in the range from 0 to (N^2) - 1. You are to sort it in O(N) time. I have been unable to find any way to do … | |
[COLOR=red][B]good day everyone [/B][/COLOR] [COLOR=red][B]i have a smart question and it is my homework i did not know how to start and what the ideas [/B][/COLOR] [COLOR=red][B]Can you help ????[/B][/COLOR] [COLOR=red][/COLOR] [COLOR=red][/COLOR] [COLOR=red][B]Write a linear-time algorithm that sorts [/B][/COLOR][COLOR=red][B]n distinct integers, each of which is between 1 and [/B][/COLOR][COLOR=red][B]500[/B][/COLOR][COLOR=red][B]. Hint: … | |
we have 2 face a problem in desiging a cell palcement techniqe using [U]force directed algorithm[/U] in VLSI. We have a matrix and want code of that relevant matrix to print that in c language.the matrix is as follow:- mod 1 2 3 4 5 6 7 8 9 Sum … | |
Hello all, Is there any algorithm to convert a python tuple to [URL="http://www.daniweb.com/techtalkforums/thread74502.html#"]MySql query[/URL]. Ex: [B] ('*','name','sliver')[/B] should convert to [B] select [Pri_Key] from [All Tables] where 'name' = 'sliver';[/B] I have been able to do so ... but my [URL="http://www.daniweb.com/techtalkforums/thread74502.html#"]algorithm[/URL] looks very ugly and have to process everything bit … ![]() | |
hi,this is sandy patel. i need simeone's help as soon as possible. i discribe my problem as under: [B]Problem Statement: [/B]This problem requires you to generate a series of random numbers. There are many algorithms that have been developed for this purpose. One scheme generates pseudorandom numbers by performing a … | |
hi,this sandy patel i have problem related to random number genre. ter . i don't understand from which is number from i have to start my program? and,upto witch number i have to go? The following steps describe the algorithm. Step 1: Enter an odd 4-digit integer seed number that … | |
Hello everyone! I am a first year student studying computer science and I am having a little trouble figuring out how to implement this part of a program. I am writing a word search puzzle generator that takes in a list of words and dimensions (such as "cat", "animal", "fish", … | |
I need help coming up with an algorithm to determine if the user clicks on any point of a line. A line is given by two points. So you have x1, y1 positions of the first point, and x2,y2 positions of the second point. I need to determine in the … | |
Hello all, Is there any algorithm to convert a python tuple to MySql query. Ex: [B] ('*','name','sliver')[/B] should convert to [B] select [Pri_Key] from [All Tables] where 'name' = 'sliver';[/B] I have been able to do so ... but my algorithm looks very ugly and have to process everything bit … | |
I'm making a program that compresses text files using the LZW compression algorithm and creates a seperate compressed file. I made a file type and extension and icon for this file type (.nct), and set up 2 actions for it - one that calls the program and passes the .nct … | |
How to sort a number of elements in stack1 ordering with the smallest is on the top of the stack, and you can use temporary stack 2?? What is the idia and time complexity of your algorithm? Can any one push me to idea?:eek: I can do it with 3 … ![]() | |
My prof. gave us this class project to do and we had to more or less fill in the blanks. So here is what i have for my code and it works up to the point where it asks you if you want to go first or not. So weather … | |
Here is the list of instructions on this assignment I am currently working on: [B]Implement a Base 7 or Base 21 InsertionSort algorithm[/B] [LIST] [*] Input: File containing a list of Base 21 numbers[LIST] [*]Name of this file is supplied on the command line [*]First element in file is number … |
The End.