This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def bubble(a): | |
| if len(a) < 2: return | |
| for i in range(0,len(a)): | |
| swapped = False | |
| for j in range(len(a)-1,i+1,-1): | |
| if a[j] < a[j-1]: | |
| a[j], a[j-1], swapped = a[j-1], a[j], True | |
| if not swapped: break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def selection(a): | |
| if len(a) < 2: return | |
| for i in range(0,len(a)): | |
| k = i | |
| for j in range(i+1,len(a)): | |
| if a[j] < a[k]: k = j | |
| a[i], a[k] = a[k], a[i] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def insertion(a): | |
| if len(a) < 2: return | |
| for i in range(len(a)): | |
| k = i | |
| while k > 1 and a[k] < a[k-1]: | |
| a[k], a[k-1] = a[k-1], a[k] | |
| k -= 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from operator import * | |
| def isInt(x): | |
| try: | |
| a = float(x) | |
| b = int(a) | |
| except ValueError: | |
| return False | |
| else: | |
| return a == b | |
| def Postfix(exp): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def adler32(string): | |
| a = map(ord,string) | |
| b = [sum(a[:i])+1%65521 for i in range(len(a)+1)] | |
| return (sum(b) << 16) | max(b) |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ============================== | |
| Methionylthreonylthreonylglutaminylarginyltyrosylglutamylserylleucylphenylalanylalanylglutaminylleuc yllysylglutamylarginyllysylglutamylglycylalanylphenylalanylvalylprolylphenylalanylvalylthreonylleucylgl ycylaspartylprolylglycylisoleucylglutamylglutaminylserylleucyllysylisoleucylaspartylthreonylleucylisoleu cylglutamylalanylglycylalanylaspartylalanylleucylglutamylleucylglycylisoleucylprolylphenylalanylseryla spartylprolylleucylalanylaspartylglycylprolylthreonylisoleucylglutaminylasparaginylalanylthreonylleucyl arginylalanylphenylalanylalanylalanylglycylvalylthreonylprolylalanylglutaminylcysteinylphenylalanylglu tamylmethionylleucylalanylleucylisoleucylarginylglutaminyllysylhistidylprolylthreonylisoleucylprolylisol eucylglycylleucylleucylmethionyltyrosylalanylasparaginylleucylvalylphenylalanylasparaginyllysylglycyli soleucylaspartylglutamylphenylalanyltyrosylalanylglutaminylcysteinylglutamyllysylvalylglycylvalylaspa rtylserylvalylleucylvalylalanylaspartylvalylprolylvalylglut |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math._ | |
| val g = () => Console.readLine("Params: ").split(' ') map ((x) => x.toFloat) | |
| val a = g() | |
| val b = g() | |
| println(pow(a(0), 2)/(pow(a(1)-b(1), 2) + pow(a(2)-b(2), 2))) |
NewerOlder