Jump to content

Featured Replies

Posted
im about to take a computer science contest on algorithms in less than two weeks. does anyone know a good website that has computer algorithm problems of various difficulty with solutions?
ah I got some links to some ebooks about algorythms somewhere.. If you need it really bad I can try to dig it up... Otherwise no lol cuz itll take me at least 10 min to get it
  • Author
thanks for the offer. i need some questions to do though. this is just a senior high school contest. if anyone know some challenging but doable algorithms questions or any websites please post them. thanks.
Could you explain a little better what you mean by algorithms? That way I'll know better what I'm looking for.

An algorithm is a set of instructions for accomplishing a task, that will terminate in a defined state.

That's as simple as it gets explained :/

  ViperX said:
An algorithm is a set of instructions for accomplishing a task, that will terminate in a defined state.

That's as simple as it gets explained :/

 

I know what an algorithm is, I was just wondering what he was trying to get across. I kind of sounds (looks?) like he wants some cryptography problems. That is unless i'm just being dumb right now and can't realize what a "compter science algorithm question" is... Can you enlighten me sir, I feel kind of dumb now. =(

  • Author
  Wheat Toast said:
Could you explain a little better what you mean by algorithms? That way I'll know better what I'm looking for.

 

this is the kind of prob im looking for:

 

  Quote

Pinball is an arcade game in which an individual player controls a silver ball by means of flippers, with the objective of accumulating as many points as possible. At the end of each game, the player's score and rank are displayed. The score, an integer between 0 and 1 000 000 000, is that achieved by the player in the game just ended. The rank is displayed as "r of n". n is the total number of games ever played on the machine, and r is the position of the score for the just-ended

game within this set. More precisely, r is one greater than the number of games whose score exceeds that of the game just ended.

You are to implement the pinball machine's ranking algorithm. The first line of input contains a positive integer, t, the total number of games played in the lifetime of the machine. t lines follow, given the scores of these games, in chronological order. Input is contained in the file s5.in.

You are to output the average of the ranks (rounded to two digits after the decimal) that would be displayed on the board.

At least one test case will have t <= 100. All test cases will have t <= 100 000.

Sample Input

5

100

200

150

170

50

 

Output for Sample Input

2.20

 

Explanation for Sample Output

The pinball screen would display (in turn):

1 of 1

1 of 2

2 of 3

2 of 4

5 of 5

The average rank is (1+1+2+2+5)/5 = 2.20.

 

this is the kind of algorithm im looking for. its pretty simple at first glance but i havent programmed for over a year so i need a refresher. i guess this is a medium difficulty programming question. so if anyone know any sites with challenges that are along the line or a little above or below, that would be perfect

  imascatman said:
this is the kind of prob im looking for:

 

 

 

this is the kind of algorithm im looking for. its pretty simple at first glance but i havent programmed for over a year so i need a refresher. i guess this is a medium difficulty programming question. so if anyone know any sites with challenges that are along the line or a little above or below, that would be perfect

 

So you're looking for word problems that need to be solved by coding? I guess I'll try to find a few later on.

just learn things like bubble sort and binary search, and write an algorithm for different list types filo and fifo
  • Author
  Wheat Toast said:
So you're looking for word problems that need to be solved by coding? I guess I'll try to find a few later on.

 

yes. exactly.

how about you go write a prime number finding algorythm:naughtyd:

 

now I know what an algorythm is, I see I've already made one myself in my prime numbers program hehe.

I like the whole prime numbers thing cuz I think it's a nice challenge to try and create the fastest best algorythm to do the job, since with a prime numbers generator the computer will have to do A LOT of calculating (ie if you generate a list with all the prime numbers from 0 to 1 milion or more). So you'll spend a lot of time trying to tweak ur code (I know I have), and im still not totaly satisfied =)

 

here's what I have so far:

 

code to generate a list of prime numbers in VB:

http://members.home.nl/frankvandermast/Priem/generator.txt

 

code to check if an inserted number is prime in VB:

http://members.home.nl/frankvandermast/Priem/checker.txt

 

here you can just dl the actual VB sourcefiles (in case you have VB):

http://members.home.nl/frankvandermast/Priem/

(btw you only need project1.vbp and form1.frm, the rest is just filling and not related to the algorythm)

 

ps. there's no comment to the code files, but I take it you're smart enough to figure it out yourself ;)

  Ayporos said:
how about you go write a prime number finding algorythm:naughtyd:

 

now I know what an algorythm is, I see I've already made one myself in my prime numbers program hehe.

I like the whole prime numbers thing cuz I think it's a nice challenge to try and create the fastest best algorythm to do the job, since with a prime numbers generator the computer will have to do A LOT of calculating (ie if you generate a list with all the prime numbers from 0 to 1 milion or more). So you'll spend a lot of time trying to tweak ur code (I know I have), and im still not totaly satisfied =)

 

here's what I have so far:

 

code to generate a list of prime numbers in VB:

http://members.home.nl/frankvandermast/Priem/generator.txt

 

code to check if an inserted number is prime in VB:

http://members.home.nl/frankvandermast/Priem/checker.txt

 

here you can just dl the actual VB sourcefiles (in case you have VB):

http://members.home.nl/frankvandermast/Priem/

(btw you only need project1.vbp and form1.frm, the rest is just filling and not related to the algorythm)

 

ps. there's no comment to the code files, but I take it you're smart enough to figure it out yourself ;)

 

Sieve of Eratosthenes ftw

Guest
This topic is now closed to further replies.