Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Any good programming challenge using the c language.

  1. Oct 29, 2005 #1
    I am currently in my second quarter learning the c language. The class is not hard at all, but i want some challenge problems. Are there any goods links?
  2. jcsd
  3. Oct 30, 2005 #2


    User Avatar
    Science Advisor
    Homework Helper

    How about writing some extended (or infinite) precision numerical routines so you can calculate things like 10,000! etc.?
  4. Oct 30, 2005 #3
    What do you mean by "precision numerical routines"? You have to be more specific.
  5. Oct 30, 2005 #4


    User Avatar

    He means represent your number as a string of characters and then write some routines to compute with the numbers. C's built in numerical types have a limited range, but if you write your own "big number" routines, the range is potentially infinite (given enough memory, of course).
  6. Oct 30, 2005 #5


    User Avatar
    Staff Emeritus

    There are loads of problems you can find here:

    http://acm.uva.es/problemset/ [Broken]
    Last edited by a moderator: May 2, 2017
  7. Oct 30, 2005 #6
    How about figuring out how to write an algorithm for an NP problem that completes in O(log n)


    just kidding.
  8. Oct 30, 2005 #7


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Searching a sorted list is an NP problem that has a solution that runs in O(log n) time. (Assuming a random access lookup counts as one unit of work)

    (Yes, I know you meant NP-complete. :tongue:)
  9. Oct 30, 2005 #8

    Very nice link. thanks.
    Last edited by a moderator: May 2, 2017
  10. Oct 30, 2005 #9
    Yes :-) I thought about it after but was to lazy to change it.
  11. Nov 6, 2005 #10
    Solving puzzles where you have to arrange things is a good one. Normally recursion (where a function calls itself) is a good way to tackle these.

    A pentomino solver is interesting. You'll find lots of these on the web, but to make it interesting, just read up on the problem and then write your own code.
  12. Nov 6, 2005 #11
    build a 3D engine.
  13. Nov 8, 2005 #12


    User Avatar
    Science Advisor
    Homework Helper

    Some of my favorites:

    1. A neural network which displays a small window allowing you to use the mouse to "draw" a number and then have the network interpret it.

    2. A multi-tasking operating system scheduler (just a simulator). The quintessential reference: "A Scheduling Philosophy for Multi-processing Systems", ACM Journal, 60's or so.

    3. A Drag-and-drop application which displays a drawing of a dorm, and allows you to drag-and-drop students into the rooms (all database operations updated concurrently).

    4. A general-purpose plotting library: Supply a function and it plots a nice report on the screen. Try doing this in 3-D as well. Add features such as point-and-click operations on the graph (enlarging, reducing, etc.).
    Last edited: Nov 8, 2005
  14. Nov 15, 2005 #13
    Get into systems side with C, C++
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook