3,815 Topics

Member Avatar for
Member Avatar for nalinibh

Hi everybody, Can anyone among you let me know.how can i find execution time of an algorithm in my c coding!! thanks Nalini

Member Avatar for Ancient Dragon
0
111
Member Avatar for yulin11

[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 …

Member Avatar for iamthwee
0
65
Member Avatar for Matt Tacular

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 …

Member Avatar for Matt Tacular
0
173
Member Avatar for Matt Tacular

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]/**************************** * …

Member Avatar for Narue
0
86
Member Avatar for Matt Tacular

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 …

Member Avatar for ~s.o.s~
0
88
Member Avatar for Matt Tacular

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 …

Member Avatar for Matt Tacular
0
102
Member Avatar for meiyantao

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. */ …

Member Avatar for WolfPack
0
174
Member Avatar for castegna

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 == …

Member Avatar for Narue
0
127
Member Avatar for aserfiotis

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 …

Member Avatar for aserfiotis
0
119
Member Avatar for jigoro

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 …

Member Avatar for jigoro
0
293
Member Avatar for Confused612

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. …

Member Avatar for Aia
0
3K
Member Avatar for sushanttambare

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 …

Member Avatar for sushanttambare
0
82
Member Avatar for openuser

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.

Member Avatar for Ancient Dragon
0
841
Member Avatar for louis7370

[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() { …

Member Avatar for iamthwee
0
108
Member Avatar for emr

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 …

Member Avatar for Aia
0
70
Member Avatar for ithelp

I guess it is postoffice shorting, does anyone know the algorithm?(need a simplified version)

Member Avatar for Rashakil Fol
0
127
Member Avatar for NOSUME

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 …

Member Avatar for Terry Robinson
0
108
Member Avatar for jrivera

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, …

Member Avatar for Narue
0
119
Member Avatar for jaeSun

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 …

Member Avatar for ~s.o.s~
1
1K
Member Avatar for Kenzero

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 …

Member Avatar for Metsfan147
0
119
Member Avatar for mutah.87

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!!

Member Avatar for mutah.87
-1
100
Member Avatar for shamma

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) …

Member Avatar for jbennet
-1
289
Member Avatar for vijayan121

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 …

Member Avatar for vijayan121
0
242
Member Avatar for Saran_57

[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]

Member Avatar for mmahima2002
-1
88
Member Avatar for shamma

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 …

Member Avatar for Rashakil Fol
0
72
Member Avatar for shamma

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 …

Member Avatar for Rashakil Fol
0
60
Member Avatar for wilj

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) …

Member Avatar for joshSCH
0
89
Member Avatar for shamma

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 …

Member Avatar for Lerner
0
78
Member Avatar for pplteo

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 …

Member Avatar for thekashyap
0
91
Member Avatar for MiloTN

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 …

Member Avatar for Ancient Dragon
0
384
Member Avatar for Rob111

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 …

Member Avatar for Rob111
0
277
Member Avatar for xexex

"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 …

Member Avatar for flexeblesteel
1
292
Member Avatar for jrivera

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 …

Member Avatar for vijayan121
0
132
Member Avatar for maria dolores

hi, I need the source code for algorithm gaussian recursive elimination method for mips R2000 language assembly. thank you.:'(

0
69
Member Avatar for faiz

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 …

Member Avatar for iamthwee
0
203
Member Avatar for jrivera

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 …

Member Avatar for jrivera
0
96
Member Avatar for abhinav.sharma

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 …

Member Avatar for abhinav.sharma
0
112
Member Avatar for Direwolf007

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 …

Member Avatar for Direwolf007
0
181
Member Avatar for saroonah

[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: …

Member Avatar for Infarction
0
91
Member Avatar for inorbit

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 …

Member Avatar for thekashyap
0
96
Member Avatar for sliver_752

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 …

Member Avatar for iamthwee
0
75
Member Avatar for civil1

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 …

Member Avatar for Ancient Dragon
0
248
Member Avatar for civil1

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 …

Member Avatar for civil1
0
213
Member Avatar for Soraji

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", …

Member Avatar for Soraji
0
102
Member Avatar for developer4321

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 …

Member Avatar for developer4321
0
95
Member Avatar for sliver_752

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 …

Member Avatar for sharma_vivek82
0
681
Member Avatar for LieAfterLie

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 …

Member Avatar for vijayan121
0
122
Member Avatar for algo_man

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 …

Member Avatar for iamthwee
0
75
Member Avatar for Praetorian

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 …

Member Avatar for Praetorian
0
386
Member Avatar for ATXFG

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 …

0
39

The End.