Download presentation
Presentation is loading. Please wait.
Published byOsborne Holt Modified over 9 years ago
1
CS Final Project 2010 Rohan Paramesh
2
The Programs Implementing 3 programs each in C# and Python Student Scheduler Assigns courses and students, sorts according to different criteria Twenty Questions A binary tree of QuestionNodes that writes out to and reads from a text file Towers of Hanoi Recursively provides a solution to the puzzle
3
C# Microsoft’s current language Compiled Java-like Syntax Logic An atmosphere of whatever Java got wrong is fixed in C#
4
Python Guido van Rossum Emphasis on readability Significant differences Logic Style Syntax Very popular nowadays with amateur developers and some large companies Google
5
Towers of Hanoi JavaC# public static void solveHanoi(int disks, int from, int other, int to) { if (disks <= 0) return; solveHanoi(disks-1, from, to, other); System.out.println("Move disk " + disks + " from pole " + from + " to pole " + to + "."); moves++; solveHanoi(disks-1, other, from, to); } public static void SolveHanoi(int disks, int from, int other, int to) { if (disks <= 0) return; SolveHanoi(disks - 1, from, to, other); Console.WriteLine("Move disk " + disks + " from pole " + from + " to pole " + to + "."); moves++; SolveHanoi(disks - 1, other, from, to); }
6
Towers of Hanoi JavaPython public static void solveHanoi(int disks, int from, int other, int to) { if (disks <= 0) return; solveHanoi(disks-1, from, to, other); System.out.println("Move disk " + disks + " from pole " + from + " to pole " + to + "."); moves++; solveHanoi(disks-1, other, from, to); } def solve_hanoi(disks, start, other, dest): '''The main recursive method that solves the Tower of Hanoi puzzle. This method calls itself and also increments the number of moves. disks -- the number of disks (integer) start -- the starting peg (determined by class constant) other -- the intermediate peg dest -- the destination peg ''' if (disks <= 0): return solve_hanoi(disks-1, start, dest, other) print "Move disk ", disks, " from pole ", start, " to pole ", dest, "." global moves moves += 1 solve_hanoi(disks-1, other, start, dest)
7
Comparison Scope Methods and Parameters Types Compiled vs. Interpreted I/O Freedom/Restrictions Accuracy Readability
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.