Suggest websites to practice C/C++ algorithms/puzzles [closed] - c++

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to practice problem solving in C/C++. But I want to avoid writing the whole program from scratch. Is there any website where they give me puzzles and the code skeleton along with it and expect me to only fill a function or two to solve the problem at hand? This would save a lot of time and I can concentrate only on the problem solving part.
Thanks.

Advent of Code posts new problems every year starting on Dec 1. The problems have a Christmas-themed story, involving Santa Claus and his elves. There are leader boards so you can compete with your friends. You can also revisit previous years problems and solve them.
Project Euler has almost 400 programming puzzles. There are no frameworks, but the first few puzzles are simple enough that this shouldn't be a problem.
TopCoder Is an online coding competition site. You can open past problems in their competition arena applet for practice. All you need to do is write the one function described in the problem. However, the problems have a wide range of difficulty. Even the easiest ones are more difficult than the beginning ones at Project Euler.

I don't know any website that works the way you said, but most of these is just simples. You just have to read from standard input and print to standard output.
http://www.spoj.pl/
http://www.topcoder.com/
http://code.google.com/codejam/
Also, most of the problems of the same site will work the same way, so once you solve your first problem, you just have to use its skeleton to solve others.

There are so many. Few of them are :
http://www.leetcode.com/
http://cpp-wiki.wikidot.com/
http://www.parashift.com/c++-faq-lite/
http://www.coderholic.com/10-more-puzzle-websites-to-sharpen-your-programming-skills/

Related

Idea for beginner's OpenMP project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a parallel programming project that I have to do in C++ and openMP that's due in a week, and I was wondering if someone could give me an idea on something a beginner in both C++ and OpenMP can accomplish in this time. I've got pretty extensive experience in Java, but this class randomly started us on C++ without it being introduced to us before had (and I understand 80% of learning code should be on my own time, but I expected more forewarning before they throw a new language at us). The instructor hasn't given us any ideas, our labs have just been tutorials through basics, and our lectures have been about how to implement bits and pieces of parallel programming... so I'm at a loss at what would be good enough for a class project. It's an elective class, so he's not expecting much, but I just don't know where to start. Thanks guys
Basics examples for OpenMP are computing PI and matrix multiplication.
More interesting topics may be:
Image convolution (edge detection, sharpening, blurring, etc.). You could use NetPBM image format for simplicity.
K-Means clustering.
You could find serial C++ examples in the Internet and adopt them to OpenMP, which is relatively easy task.

AI for time table generator software [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to develop a time table generator software for my college. Obviously it requires a great deal of constraint satisfaction i.e. I need to satisfy a lot of rules in order to generate a bunch of time tables where classes do not clash. After doing some research and reading this article, I feel I need to use some AI in it. Now, I am a complete newbie to AI. Can anyone tell me which algorithm will work best in my case?
The simplest algorithm that you can use for this problem is genetic algorithm (or any other evolutionary algorithm). Solving this problem using GA is very simple but yet effective. There are lots of papers and codes that have used this approach for this problem.
If you have few rules and constraints, you may want to use exact straightforward techniques like backtracking with CSP heuristics to speed it up, but if there are lots of classes and constraints, I suggest Genetic Algorithm.
Well, not a trivial task indeed. Problems like this one are VERY hard to solve.
Here I can recommend you two things:
Use an existing CSP/COP solver and describe your constraints in its language. These solvers are very good, fast and tuned, being developed for years.
Educate yourself in the area of Discrete Optimization (there was a course at coursera.org with the same name which was great). Only after you grasp the basics of how these things work can you try to write your own solver. But let you be warned! Discrete optimization is pain and suffering :-).
This is by no means a suitable place to just tell you how CSP/COP works. It is a very broad and difficult field.
I wish you good luck!

Style and Enumerators [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
So, in the process of taking a data-structures class (in C++), my professor wanted us to manipulate a linked list of playing cards. That doesn't matter however, what I am interested in is why she did not use an enumerator to represent the suites.
In her code, she used strings to hold the suite of a card. This seemed inefficient because she wanted us to sort them based on suite, under the circumstances, it would have been considerably easier if she had used an enumerated type instead of a string. The string did not offer any help either, because in printing the suite, she output a Unicode character, roughly doubling the length of her function, simply because she did not use an enum.
Is there any reason for her to have done this, or does she simply have strange preferences when it comes to code style?
If you really want to know what your professor's reasoning is, you have to ask your professor. I can only speculate.
But if I were to speculate, I would guess that there are two possible reasons why your professor chose to use strings as descriptors for these attributes.
She is trying to keep the code simple and easy for newbie C++ programmers to understand. Whether the means meet the goal is debateable.
(Personal bias alert) Professors and others in academia, with no real-world experience, often do and teach things that I would consider to be highly sub-optimal.
My guess would be that she either had not considered that approach or that she wanted to test your ability to work with sorting strings.
Code examples might help in that they might clarify what she did and what you think she should have done.
The likely answer is that she just didn't think about the problem she was using to demonstrate whatever she is trying to teach you. That is, she wanted you to focus on sorting (for example), and probably took some code written by someone else and just adapted it to that purpose without much thought.

What can a second year computer undergrad do which might be considered worthwhile in the future? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Besides taking classes I mean. I want to make myself stand out from the crowd. I am very good at building logic/algorithms. Like I can implement any problem in C. But I don't know how to harness it! Like what to code!?!
All I have made upto this point is games that too in C's console, using ASCII and character arrays. Snake, Sudoku (making a puzzle and solving too), rip-off of Mario Bros., tictactoe with AI. But making games won't get me anywhere.
I was wondering if I could get suggestions from you guys?
I know C++/C and a little Java. I have just got started with data structures. So, it would be great if it would be relevant to data structures. I know about most trees and types of data structures. Thanks a lot for your help.
I know it's off topic but I have nowhere else to turn to.
Pay attention in your finite automata classes. Learning the basis of all languages makes "knowing" a language irrelevant.
If your school offers it, take some business computer systems classes.
Try to get some project management experience under your belt. This could be done by doing work for charity or an internship for a prof.
Of course there is always open source projects as well.
Get a job. I was working for a small development shop as a second year student.
Open your own company, and start doing some mobile apps. The sky is the limit.
If you want to have long term impact, you can do one of two things:
Be a genius, and invent a new gizmo everybody needs. [Extra points].
Build a foundation for something. Add to it cleanly, continuously. Eventually it will have enough mass to have an impact.

Ideas for storing and operating on huge numbers in C++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am supposed to build a program for storing and handling huge integers. I know that there are many answers out there but I need ideas that I can implement easily, bearing in mind that I can use any of the basic concepts of C/C++.
How should I go about it?
This is the first time I am asking a question here so please correct me if I am wrong about anything.
Edit: Actually what I wanted to know was how should I go about storing a huge integer... Obviously an array is what comes to mind at first glance but are there any other methods out there at the basic level?
EDIT2: I came across a very nice solution to this problem a while ago, but was just a bit lazy to put it on here. We can use the concept of number systems to deal with huge numbers. We can declare an array that holds the co-efficient of powers of 256, thus obtaining a base 256 system. We can then use fundamental concepts like those of the various number systems to obtain our required results.
Matt McCutchen has a Big Integer Library
If you want to do this yourself his code would be a great starting point. As you can overload arithmetic operators in C++ it is not too difficult to make a new BigInteger class and make this handle any number of bits per integer.
There is also a stack overflow answer to this question: here
I consider this as a question about theory, as such I suggest to browse the internet using the right keywords for documents/articles or to take a sneak peek at libraries that are implementing this feature and are well tested, this projects also tend to offer a mailing list or a forum where developers can communicate, it can be a good place to start writing about this stuff.