3,815 Topics

Member Avatar for
Member Avatar for sujskiez

Write a C++ program such that its execution will keep asking the user to enter a pair of integers, start and finish, and will terminate when either start>finish, or EOF or an invalid input has been encountered. Every time a new pair of integers start and finish are read, the …

Member Avatar for zeroliken
0
201
Member Avatar for ~s.o.s~

In case you are not not aware, Stanford has started offering free online courses (as in real courses and not just video lectures) for topics like Database design, analysis of algorithms, CS 101 etc. Classes like database class, AI class and machine learning class are already live and a host …

Member Avatar for Tofayel
3
541
Member Avatar for MrHardRock

Hey guys, I recently had an assignment to write a sort algorithm we have not yet gone over in class. I had no problem getting my code written and to compile, but now that it compiles I keep getting an error that says "Exception in thread "main" java.lang.NoSuchMethodError: main" I …

Member Avatar for Ezzaral
0
230
Member Avatar for Troy III

We know we already have built-in [I]Trim methods[/I], but trimming doesn't get rid of internal, (and unwanted) extra spaces. -So this is where Normalize method comes to play. It trims left, it trims right, but most importantly it also trims on the inside, one could say: "it trims inside-out". In …

Member Avatar for Troy III
0
325
Member Avatar for cryonize

Hello again, I am asked by my professor to create a program using selection sort in a linked list. Selection sort with sorting only the data is pretty easy, but I'm having a hard time because he made us sort the nodes themselves. Can anyone help by giving atleast the …

Member Avatar for mike_2000_17
0
10K
Member Avatar for hwoarang69

I am so confused on how to tell a run time of a algorithm. so i came up with some ex for me to understand. could any one tell me if i am find the run time right plz. ex1 - run time for this loop is O(n)? bc it …

Member Avatar for hwoarang69
0
154
Member Avatar for rmbrown09

Quick synopsis: Program sorts array the user inputs. IE enter 5,6,78,4,2 and it will sort it in order. Through various algorithms. This works great with quick small lists, but for some reason with one large number or longer lists the program will crash. Here are the files if you would …

Member Avatar for rmbrown09
0
149
Member Avatar for modesto916

Good day, My Data Structure teacher asked me to do a list of exercises, and one of the questions consists of writing a program to solve the numbers decomposition problem, for example: If the user types the number 5: 5 4 + 1 3 + 2 3 + 1 + …

Member Avatar for MonsieurPointer
0
66
Member Avatar for Mohammad Mateen

can any one please explain how time complexity of an algorithm is computed in Visual Programming

Member Avatar for TrustyTony
0
135
Member Avatar for GillBates

Greetings! I was looking through this Rabin-Karp algorithm code. Everything is fairly clear to me, except those "-48" numbers (lines 13, 14 and 25)... So I was just wondering if anyone could explain, why are they used for? (maybe for string to int transformation?). Can you please explain it with …

Member Avatar for Ancient Dragon
0
73
Member Avatar for gourav1

actually, i want to calculate 2^60000 in 1 second. i have tried a way but it is giving output in specified time for 1000 power only.(i have used arrays to store a one integer). will you please give me a hint only how to do that ? [B][I][U]"I AM NOT …

Member Avatar for TrustyTony
0
1K
Member Avatar for JamesGreen

I am working on a recursive flood-fill function with 4-connected neighbours as part of a drawing application program. However, my attempts keep resulting in the program crashing. I am coding in C, however I will just post pseudo-code of my algorithm. I am hoping somebody can help me see what …

Member Avatar for Banfa
0
164
Member Avatar for triumphost

Why does my delete function crash? I've used the same algorithm for other 2D vectors and it works perfectly fine.. I'm trying to remove an array of vectors from a 2D vector all of the std::string type. [CODE] //Ripped out of a massive class I wrote. vector<vector<string>>& Delete(vector<string> StringArrayToDelete, bool …

Member Avatar for histrungalot
0
699
Member Avatar for butler273

So, I'm back once again. This week I'm having issues with efficiency in a Radix Sort Algorithm. From what I understand this is the foundation of this algorithm. What operations might be costing me? For the basics I suppose I do understand push_ back being costly having to copy the …

Member Avatar for butler273
0
312
Member Avatar for uzii305

OK, i'm working on a hangman game in cmd prompt. I'm about halfway done, but i have hit a wall regarding the secret word, and the user guess. Now mind you, my professor has not taught the class any array manipulation methods or techniques for finding specific char in an …

Member Avatar for uzii305
0
376
Member Avatar for Na'Vi

Hi, I'm having some problems with my program and I'm not sure how to fix them. I have a main method that starts out with a frame. [CODE]public class Cryptography { public static void main(String[] args) { CryptoMainMenu mainMenu = new CryptoMainMenu(); JFrame frame = new JFrame("Cryptography"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(mainMenu); frame.pack(); …

Member Avatar for Na'Vi
0
123
Member Avatar for apanimesh061

If we are given a data set which has student marks, GPA and Attendance, how can KNN be used to find the best 4 students? I admit, that this is a homework question, but I am not asking for the code ... I will do that myself.... I only need …

0
65
Member Avatar for Yoink

I have to write a program that will print the chain of a number using a hailstone function, as well as with a range of numbers. That part of my program works perfectly but I cant figure out how to write a function that will find and hold the number …

Member Avatar for TrustyTony
0
597
Member Avatar for NinjaTwinkie13

So I've currently been studying C++ independently for a couple weeks with the help of good old books. One of the exercises was to make a "games library" where you can see your list of games, add a title, or delete it (has nothing to do with games). The catch …

Member Avatar for NinjaTwinkie13
0
156
Member Avatar for Srcee

I have two tables in my database - Category and Food. Food has idCategory. Category has id and idParentCategory. From them, I need to create a string which will look like this (or xml): <?xml version="1.0"> <tree id="0"> <item text="Category1"> <item text="Food1"/> <item text="Food2"/> </item> <item text="Category2"> <item text="Category1"> <item …

Member Avatar for thines01
0
172
Member Avatar for seemeamal

Dear all, Am half way through my computer lab management project. to generate the timetable automatically i've written an algorithm. and for it to work i need an sql query that can : table-> ttprofile: id lab_name subject_name. now i looked every where, is there a command to take the …

Member Avatar for seemeamal
0
108
Member Avatar for user543820

Hello! I am trying to implement search algorithms in a 2D grid. The problem I am facing is that let's say that I make a 2D grid in c++ through some array and also block some cells. Now how will I convert this grid into a binary tree to run …

Member Avatar for L7Sqr
0
124
Member Avatar for Zvjezdan23

What did I do wrong? Can anyone please explain to me so I can learn? [CODE] #include <iostream> #include <string> #include <cmath> #include <math.h> #include <algorithm> using namespace std; class Distance { private: int length; public: Distance(int length = 0); int operator *(Distance My_Trip); int trip_length; }; int Distance::operator *(Distance …

Member Avatar for Zvjezdan23
0
122
Member Avatar for swissknife007

I am trying to implement a program for finding the remainder on division of 2 numbers n2/n1 such that n1 is of the order of 2^32(having a few digits) and n2 is the order of 2^65536(having about 20000 digits) So far I have stored them in an array digit by …

Member Avatar for Banfa
0
147
Member Avatar for Johnathon332

Hi guys, I was wondering if this was a good place to use a goto statement? I know this will get stuck in an infinite loop eventually and I am working to fix that right now. However I wanted everyones views on whether or not this is acceptable, the goto …

Member Avatar for mike_2000_17
0
189
Member Avatar for abhishekagrawal

Dear All, I have written a code to implement an algorithm for base conversion from decimal to any base between 2 and 36 given in RG Dromey. Below is my code and I have a few questions relating to it: [CODE] #include<stdio.h> #include<stdlib.h> int main() { int newbase,zero=atoi(0),q,ndigit=0,r,ascii,i; char newrep[100]; …

Member Avatar for thines01
0
279
Member Avatar for Na'Vi

Hi, I'm trying to make a menu and when you click on one of the JButtons, it'll go from my first class's GUI to my second class's GUI. But when I run the program, and I press the button algorithm, it changes to a blank screen, and not to the …

Member Avatar for Na'Vi
0
73
Member Avatar for swissknife007

[CODE]There is a single ring road that runs over the circumference of this circle and connects all the boarding points. There are also N - 1 different shuttle agencies available in Bhiwani. For every different boarding points A and B there is exactly one shuttle that connects these points and …

0
99
Member Avatar for kiail

Okay, so I have a bubble sort that has some issues. It is meant to sort 10 random numbers, and it does....however, in the console I have to press enter about 11 times for it to produce results, what can I do to fix that?? Here's my code: [CODE]using System; …

Member Avatar for Momerath
0
166
Member Avatar for london-G

Hello, I am currently working on an algorithm and i am quite confused. The algoritm is: Put q = 19 1. For i=1 to 3 If the ith element of the list is a letter then If the letter’s position in the alphabet is an odd number then q = …

Member Avatar for london-G
0
102
Member Avatar for Vasthor

what's the problem? E:\Tools\Programming\C++ Programming\CodeBlocks\Project\Knowledge_Based_Project\Exercise_Temporary_Compiler\Exercise_Temporary_3\main.cpp||In function 'int main()':| E:\Tools\Programming\C++ Programming\CodeBlocks\Project\Knowledge_Based_Project\Exercise_Temporary_Compiler\Exercise_Temporary_3\main.cpp|36|error: invalid use of member (did you forget the '&' ?)| ||=== Build finished: 1 errors, 0 warnings ===| [CODE] #include <algorithm> #include <iomanip> #include <iostream> #include <string> #include <vector> using namespace std; int main() { // informed user cout << …

Member Avatar for histrungalot
0
1K
Member Avatar for Zvjezdan23

Hi everyone! =) Since my teacher can't help me out or doesn't respond when his hours say he's in his online office, I need some help. I am coding Tetris; and I have to say I'm doing a decent job so far. I just need help with constant movement. =/ …

0
86
Member Avatar for minxminx

This is a code which sorts arrays. I use clock_t to determine the processing time for my code. However, it always stacks with the time taken from before. It looks like it's just adding the results. [code] int main(int argc, char *argv[]) {unsigned long n;//size of array -- long for …

Member Avatar for Labdabeta
0
627
Member Avatar for exdx

hey, i am a beginner and we got stuck with my algorithm homework assignment on radixsort. question is followed: struct listnode *radixsort(struct listnode *data, int a, int k) which takes a linked list of unsigned long integers, each less than a^k, and sorts them by k rounds of bucketsort with …

0
43
Member Avatar for adil_bashir

hello everyone, I have implemented RSA algorithm in java but now i am asked to determine the time for encrypting variable length messages(plain text). As an example, i have to find the time in which input message of length 3 will get encrypted, similarly the time in which input message …

Member Avatar for DavidKroukamp
0
262
Member Avatar for NinjaLink

In this Quicksort algorithm, it uses the pivot in the first location of each list. I am having difficulty understanding how to do this algorithm. When I look at examples online, and work out the problem(s) myself, it seems like the book does it differently, and I'm not sure what …

Member Avatar for NinjaLink
0
142
Member Avatar for lxXTaCoXxl

I'm having trouble calculating the Nth root of a given value. I don't understand what's going wrong in the algorithm, but the values are incredibly close. Only off by about 0.78891 for small values, and about 0.52 for larger ones. So any help with this is appreciated; I don't want …

Member Avatar for Momerath
0
159
Member Avatar for phorce

Hello, I have a major problem with a Correlation algorithm I'm trying to implement.. Basically, when I have two small matices: Matrix 1: 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 1 1 0 0 0 0 1 1 1 …

Member Avatar for phorce
0
94
Member Avatar for lxXTaCoXxl

I'm not sure if I remember how to do the Quadratic Formula because I haven't had to use it since I learned about it back in '05. So I did a little research on how the formula works and from what I understand the formula is: [code] // -b +- …

Member Avatar for skatamatic
0
301
Member Avatar for Vasthor

in coding, how do you actually track down the bug??? example this code where we want to find the quartile.... ignore the "odd" part, not done on there yet, but the even part just successfully running but produce no result after input (0, random huge number, and another 0) [CODE]#include …

Member Avatar for mike_2000_17
0
107
Member Avatar for danielbala

Hi.. I am trying to write a k nearest neighbor and BART bayesian additive regression tree algorithm for identifying Spam emails in php Can any1 guide me on how to implement these algorithm ? This is for my thesis..im just learning php.. If some one could give me sample code …

Member Avatar for danielbala
0
101
Member Avatar for WigglesMcMuffin

Hello, This isn't the typical "I wrote a heap sort that doesn't work, help me please" thread, instead, I'm one step before that. I'd really like to [B]understand[/B] the innards of a heap sort before I attempt to write one. I'd like to give it a go from scratch, or …

Member Avatar for DavidKroukamp
0
219
Member Avatar for markusd5454

Please provide a pseudocode algorithm for this question please. Please do the pseudocode for Python 3.2.2 Write a program which asks the user to enter a username, and then a password. Then when they type the command “log off”, they will have to retype their username and password in order …

Member Avatar for TrustyTony
0
156
Member Avatar for Zvjezdan23

header1.h [CODE] #include <iostream> #include <string> #include <cmath> #include <math.h> #include <algorithm> #include <Windows.h> #include <conio.h> using namespace std; int gotoxy_object(int x, int y) // your object { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); COORD point; point.X = x-1; point.Y = y-1; SetConsoleCursorPosition(hConsole, point); return SetConsoleCursorPosition(hConsole, point); } int gotoxy1(int x, int …

Member Avatar for Labdabeta
0
528
Member Avatar for minghags

I want to change chars in string like this: if i input DaniWeb it will change it to EbojZfc I've come so far: But this changes to z at the end :S Please any help... [CODE]#include <iostream> #include <string> #include <algorithm> using namespace std; int numChars(string besedilo); int numWords(string besedilo); …

0
85
Member Avatar for crazymidget01

I have a project where we are calculating the cost of shipping a product from manufacturer to warehouse using North-west corner and also using another method to find the minimum cost to meet the demand. I am stuck on coding the minimum cost algorithm, I understand the minimum cost algorithm, …

Member Avatar for ejosiah
0
3K
Member Avatar for anthonyjpv

Hi! Could someone show me how to implement swap algorithm in php and mysql? ie: I have 4 records in a table each are sorted by column position say position 1 2 3 4 if I move an existing position from 4 to 1 number 1 will be moved to …

Member Avatar for newbie1234
0
127
Member Avatar for gerard4143

Is it possible to pass a map container to the copy algorithm and display it to the std::cout? If so how? What I tried below doesn't work but it looks like it should. Any comments or pointers will be appreciated. [code] #include <iostream> #include <string> #include <map> #include <algorithm> #include …

Member Avatar for gerard4143
0
368
Member Avatar for HEMAMBUJAVALLY

Where can i get the header files. I need to covert the BLS algorithm from C to VB.Net. So i need to understand every lines in this code. [URL="http://crypto.stanford.edu/pbc/chunked/ch02.html"]http://crypto.stanford.edu/pbc/chunked/ch02.html[/URL] Please guide me. I need an example to perform BLS algorithm(like bob and alice example). I'm feeling difficulty in this algorithm. …

0
45
Member Avatar for pwnerboy

What we are to do is pretty much mentioned in the comments of the code. I have to make a class ARRAY, which searches a list etc... Right now I can't compile this and I'm so stuck. Please help :) Array.h [CODE] // Put comments about the class here. #ifndef …

Member Avatar for mike_2000_17
0
894

The End.